This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
GOOPS: New syntax for `define-method'?
- To: guile at sourceware dot cygnus dot com
- Subject: GOOPS: New syntax for `define-method'?
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: Mon, 10 Apr 2000 23:26:05 +0200
- Reply-to: Mikael Djurfeldt <djurfeldt at nada dot kth dot se>
I'm getting mad at again and again typing things like:
(define-method (foo (x <integer>) y)
...)
instead of
(define-method foo ((x <integer>) y)
...)
The latter is tricky to write when you're accustomed to writing
(define (foo x y)
...)
Therefore, I suggest that we change the syntax for `define-method' from
(define-method NAME (PARAM-SPEC1 ...) BODY1 ...)
NAME ::= SYMBOL | (setter SYMBOL)
to
(define-method (NAME PARAM-SPEC1 ...) BODY1 ...)
In an intermediate period, we can support most of both syntaxes
simultaneously. Note, however, that
(define-method (setter SYMBOL) EXP1 EXP2)
is ambiguous.
According to the old syntax, EXP1 is the formal parameters of a method
on the generic function (setter SYMBOL).
According to the new syntax, EXP1 is the first body form of a method
on the generic function `setter' with specializers ((SYMBOL <top>)).
Since the latter alternative is unlikely and can be written
(define-method (setter (SYMBOL <top>)) ...)
the old syntax interpretation can be used in the intermediate period
before the old syntax is removed.
Comments? Opinions?