This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Syntatic sugar and identifier permissivity
- To: lalo at hackandroll dot org
- Subject: Re: Syntatic sugar and identifier permissivity
- From: Michael Vanier <mvanier at bbb dot caltech dot edu>
- Date: Mon, 3 Apr 2000 18:40:54 -0700 (PDT)
- Cc: guile at sourceware dot cygnus dot com
- References: <20000403213207.E4496@hackandroll.org>
> From: Lalo Martins <lalo@hackandroll.org>
>
> Like it or not, syntatic sugar is a fundamental part of what
> makes a language good for day-to-day use. As I like to say, 95%
> of Python (the language) is syntatic sugar.
>
> === GOOPS ===
>
> And slot-ref/slot-set is really bad on this aspect. Even
> accessors are bad because when you're coding you don't want to
> think you're running a function with your object as an argument
> (which is what an accessor looks like, and it's more or less
> what it actually is, but that is off the point).
>
> Actually most of OOP itself is syntatic sugar :-) so I'd like
> to request some sweetening of GOOPS. Get any character which is
> not valid in an identifier acording to r[45]rs; the comma would
> be specially good for that. Then use this as a special accessor
> syntax, so that
>
> (print foo,bar)
>
> is equivalent to
>
> (print (slot-ref foo 'bar))
>
> Another possibility is the apostrophe - foo'bar - either way
> looks better than what we have.
>
> Accessing methods like this would be cool too, but this should
> NOT be implemented because it's contrary to GOOPS concept of
> methods (based on generics, not traditional OOP).
>
I like this. I'd still prefer `foo.bar' but this violates the lexical
conventions of scheme (which I think are looser than they need to be).
Dylan had (has?) this even for generic functions; you could do:
do(foo, arg1, arg2)
or
foo.do(arg1, arg2)
Whether this introduces more confusion than it prevents is an open
question. Having `foo,bar' only apply for accessors seems reasonably
consistent, though. It seems to me it wouldn't be a huge job to write a
reader that supported this syntax, either.
Mike