This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Syntatic sugar and identifier permissivity



> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]