[Top][All Lists]

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

Re: goops question

From: Dirk Herrmann
Subject: Re: goops question
Date: Mon, 8 Jul 2002 21:59:11 +0200 (CEST)

On 8 Jul 2002, Marius Vollmer wrote:

> Dirk Herrmann <address@hidden> writes:
> > "define-class, define-generic and define-accessor can only be used at the
> > top level"
> I'm not calling myself an expert here, but I would say that it is very
> valid to use 'define-class' inside some lexical scope.  Just think of
> utility structs that are only used in one function.

Surprisingly, define-class is the only one of the three where in the code
it is explicitly checked that it is only executed on the top level.  For
this reason, the definition of define-class could really easily converted
to use an mmacro instead of a macro.

For define-generic and define-accessor things are different:  In the code
there is no explicit check for asserting execution on the top level.
However, I was not able to make define-generic work in a lexical scope:  I
always get 'bad define placement' as a result - although I don't
understand it.

However, if it was granted that define-class, define-generic and
define-accessor are all three just used on the top level, they can simply
be converted to use an mmacro instead of a macro:  just exchange the call
to procedure->macro by a call to procedure->memoizing macro, and you are

Thus, I would like people to confirm that it is actually not possible to
use define-class, define-generic and define-accessor other than at the top
level.  If someone can give us an counterexample, things will be more

Best regards
Dirk Herrmann

reply via email to

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