[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare in with-slots
- To: piazza%lisp.DEC@decwrl.dec.com (Jeffrey Piazza)
- Subject: Re: declare in with-slots
- From: kempf@Sun.COM
- Date: Thu, 11 Aug 88 08:06:21 -0700
- Cc: email@example.com
- In-reply-to: Your message of Wed, 10 Aug 88 09:50:50 -0700. <8808101650.AA24519@decwrl.dec.com>
>Just because the expansion is relatively simple doesn't, of course, mean that
>it's really the "right" thing to do.
Are we talking religion or engineering? If the former, then count me in
as a lang-nostic. :-)
Seriously, there is rarely ever a single "right" way to engineer anything.
There are usually pros and cons on both sides. The "pro" of this solution
is that it is simple, the "con" is that it treats type declarations for
pseudo variables differently from those for lexical variables or other
>What if I, a random user, wish to write e.g. my own "with-file-attributes"
>macro, that lets me access things like the read and write dates for a file as
>symbol-macrolet "variables". Not being an implementor, I don't have access to
>the system declaration-parsing stuff, so I can't support declarations in the
>way you're proposing for with-slots and with-accessors. I cry "no fair".
This is a valid point, but I wonder if it isn't in the same category as
generalized code walkers.
>I am aware of no other macro which has to parse declarations -- they just get
>pushed off to some special form or other. I think that, for what you're
>trying to do, you have to make symbol-macrolet be a special form, and do
>declaration processing there.
Two points here. First, though I've got no objection either way on making
symbol-macrolet be a special form, the goal of Common Lisp was (and I
think still is) to limit the number of special forms. Second, I think
it would be a mistake to confuse general declaration parsing with parsing
of declarations for pseudovariables. Symbol-macrolet will have to do declaration
parsing for pseudovariable declarations in any event. While there are no
macros which currently do declaration parsing, there are plenty which
do parsing (like defstruct).
As a point of reference, HP Lisp had a special form called let-pseudo
whose semantics were identical to symbol-macrolet, and were used for
a similar purpose, namely to provide lexical scopes in which
slot names could be used as pseudovariables for slot access. Type
declarations included in the class definition were included in
the substitution form for the pseudovariable. I don't recall if
declarations for pseudovariables were parsed (perhaps someone still
having access to HP Lisp could check), but I wouldn't be suprised
if they were.