[m-rev.] field syntax (was: smart recompilation)
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Jul 4 20:46:31 AEST 2001
On 04-Jul-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > From: Tyson Dowd [mailto:trd at cs.mu.OZ.AU]
> > Sent: 04 July 2001 09:46
> >
> > On 03-Jul-2001, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> > >
> > > Ah, but part of the design is to allow you to create pseudo-fields
> by
> > > writing a function or two. This means that you can use field access
> > > functions (and field access syntax) outside the defining module
> without
> > > forcing yourself to always have that field (as long as you can
> extract and
> > > maybe set equivalent information somehow). So Object ^ field may or
> may not
> > > be a real field.
> >
> > That is fine, this is part of the design that is nice.
> >
> > But it doesn't have to have the syntax Field(Object).
>
> I don't see what the problem is. I find the field access stuff easiest
> to understand as a syntactic transformation.
Nobody is saying that it isn't going to be a syntactic transformation,
but that we would like to change the syntactic transformation to be a
different transformation.
> Are you saying that it is bad style to use field access functions
> for other purposes and that the language should forbid such things?
>
> For the record I'd vote against such a proposal [let the holy syntax
> wars begin...]
I believe
- The field access syntax should represent field access (or
something intended by the programmer to be field access).
If you want function composition, by all means add it to the
language with the same properties that ^ currently has.
But I don't think field access should do double duty as
general function composition.
In particular, the field access syntax should be
distinguishable from constructors or ordinary functions.
A user should have to be explicit when they want to define or
use a field access function.
- Adding field access functions to a type should not invade the
user's namespace.
> As I mentioned in reply to David Overton's posting, I find the idiom
> using (^) as a kind of reverse function composition to be an aid to
> readability, but that's probably because my view of field access is
> that it is just syntactic sugar.
Sure. It's nice. But it isn't field access, it's just a property of ^
that you are using.
--------------------------------------------------------------------------
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