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

Peter Schachte schachte at cs.mu.OZ.AU
Thu Jul 5 01:25:52 AEST 2001


On Wed, Jul 04, 2001 at 07:51:57PM +1000, Fergus Henderson wrote:
> 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.

Sorry, but you can't have one.

I think we've all agreed it's a good thing to be able to change the
representation of a data structure without changing its interface.  That
means that the designer of the data structure reserves the right to lie to
you about the structure, so you can't have a clear (and accurate) mental
model.

And anyway, what's the difference?  Asside from representation, how is a
unary function different than a data member?  If a value is completely
determined by some term, you can think of it as a property of that term.  It
*could* always be stored in the term, if there were some reason to.

That argument only covers unary functions, but it can kind of be applied to
higher arity functions, too.  Some properties are parametric.  You have to
consider an array's elements to be properties of the array, and they need
parameters.  Which n-ary functions can be seen as yeilding a property of one
of their arguments and which cannot is not even vaguely clear to me.  It's
certainly not a crisp, clear distinction.  Is the mapping of an key in a map
a property of the map once you've specified the key, or a property of the
key, once you've specified the map?

To me this is a distinction that doesn't make a difference.  I just look at
the ^ operator as reverse order function application.  Kind of like the unix
pipe operator.

> 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.

What's the difference?  Can you give us an algorithm for deciding whether a
unary function is "field-like" or not?  If not, then you are creating a
distinction that different people will use different ways, and you are going
to draw wrong conclusions (the wrong mental model) from others' decisions.

-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  We must not think that computation
http://www.cs.mu.oz.au/~schachte/      ... has place only in numbers.
Phone:  +61 3 8344 9166                    -- Thomas Hobbes, 1655 
Fax:    +61 3 9348 1184                
--------------------------------------------------------------------------
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