[m-rev.] field syntax (was: smart recompilation)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jul 4 19:51:57 AEST 2001


On 04-Jul-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> I also think it's a bit of a wart in the current design that you can
> write a 
> 	X = "hello" ^ to_upper
> 
> but to_upper is not a field access function and was never intended to be
> one.

I thought about it a bit more earlier today, and I think I can now better
explain my objections to the current design.

Basically want I want is to have a clear mental model of what is going on.
The language syntax should reflect that.

In other words, the language syntax should be designed so that readers
can quickly and easily build up a mental model of what is happening in
the source code.

In my mental models, I distinguish between field-like things
(a.k.a. "attributes" in Eiffel/Sather or "properties" in C#)
and arbitrary functions (such as `to_upper').  This is an
important distinction in the way I think about things.

With the category of field-like things, there's also a further distinction:
field-like things can either be real fields, or they can be implemented via
get/set access functions.  But this distinction is much less important --
it's just an implementation detail.

The current syntax hides the distinction between real fields
and pseudo-fields implemented via access functions, which is good.
But it also hides the distinction between fields and arbitrary functions.  
This I find very jarring, because I can't tell from the syntax how to
form my mental models.  When I see

	X = Y^foo^bar

I have no idea whether foo is something that I should think of as a field,
or whether it is just an arbitrary transformation like to_upper.
Because I have very different mental models for those two categories,
I need to resolve that distinction before I can form a coherent mental
model for the expression Y^foo.  Well, sometimes I can carry around the
idea of foo as being in a quantum superposition of those two states,
but that gets difficult to reason about pretty quickly ;-)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list