guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macros, procedure->macro


From: Dirk Herrmann
Subject: Re: macros, procedure->macro
Date: Mon, 8 Jul 2002 22:23:22 +0200 (CEST)

On 7 Jul 2002, Marius Vollmer wrote:

> Dirk Herrmann <address@hidden> writes:
> 
> > So what is so special about the uses of procedure->macro at the places
> > above?  
> >
> > [checking for redefinitions.]
> 
> We need to restrict this redefining behavior of 'define-class' et all
> to the top-level.  Local class definitions should not redefine classes
> outside of their scope (that would lead to a funny version of dynamic
> scoping of classes, eew), and redefinitions directly in one scope
> should be an error, just like any other definitions.

OK, I have changed the definitions of define-generic and define-accessor
to only show their re-defining behaviour if executed on top-level.  I also
changed all three (define-class, define-generic and define-accessor) to
use mmacros, which then would not change their behaviour at all.  Finally,
I changed define-class in stklos.scm to also use a mmacro, which is also
safe if no other 'define-class' code uses macros any more.

That means, after I have checked these changes in, guile itself will be
clean of using the built-in so called "macros", which are not really
macros in the scheme sense.

> Redefinitions on the top-level do make sense and can be supported by a
> normal macro via explicit module manipulations, i.e.
[...]

I am not sure I like the way, goops is based on names instead of objects
at a lot of places.  For example, it is not possible to do the following:
  (use-modules (oop goops))
  (define-generic G)
  (define (get-generic) G)
  (define-class <foo> () (x #:accessor (get-generic)))
because instead of a value, define-class expects a symbol after the
#:accessor keyword.

Automatic redefinition of classes is IMO a critical issue:
Redefinition of a class means to change the structure of all objects
of the class that already exist.  This should be a well considered
step and should not happen automatically (I am not even sure whether
it is a good idea at all).  It is not too inconvenient to request the user
to call class-redefinition instead of define-class.  It will inhibit
accidential redefinitions.

Just my opinion...

Best regards
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]