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]

Syntatic sugar and identifier permissivity


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

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

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://www.webcom.com/lalo           mailto:lalo@hackandroll.org
                 pgp key in the personal page

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar

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