This is the mail archive of the
mailing list for the Guile project.
Syntatic sugar and identifier permissivity
- To: guile at sourceware dot cygnus dot com
- Subject: Syntatic sugar and identifier permissivity
- From: Lalo Martins <lalo at hackandroll dot org>
- Date: Mon, 3 Apr 2000 21:32:07 -0300
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 rrs; the comma would
be specially good for that. Then use this as a special accessor
syntax, so that
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).
=== GUILE ===
However, this is currently not possible because Guile accepts
_anything_ (as far as I've tested) in symbols, as long as the
first character is valid. I don't know about r4rs, but r5rs
tells me this is wrong.
So IMHO Guile should be a little more strict about this, and
then perhaps export interfaces for modules or client programs
(in the case of libguile) to give special meanings to such
mixed syntaxes. Or perhaps just make them all plainly illegal
except for the hash symbol and then adding hooks similar to
read-hash-extend for the case when the hash occurs inside a
symbol (then the GOOPS+sugar could use something like foo#>bar
or foo#.bar or whatever looks good).
Hack and Roll ( http://www.hackandroll.org )
News for, uh, whatever it is that we are.
pgp key in the personal page
Brazil of Darkness (RPG) --- http://zope.gf.com.br/BroDar