Re: #;
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Mon, 31 Dec 2007 11:53:15 +0100
Rob Warnock wrote:
Kaz Kylheku <kkylheku@xxxxxxxxx> wrote:
+---------------
| > I have seen many examples using #+nil for this
| | That and #+IGNORE will break if someone adds IGNORE or NIL to
| *FEATURES*.
| | What will not break is #+(or). This actually has the meaning of
| ignoring the following expression no matter what.
+---------------
I actually prefer Erik Naggum's suggestion of #-(and) for that,
since the minus implies "turn it off" to me more than #+(or)
[which just feels "backwards"]. That also lets you change only
one character to turn it back on with #+(and), and again the
plus implies "on" to me [rather than using #-(or) for "on"].
But for some time now I've been using an even simpler pair,
namely, #+- to turn a form "off" [mnemonic: "from on to off"
or a "falling edge"] and #-+ to turn a form "on" [mnemonic:
"from off to on" or a "rising edge"], e.g.:
> (list 1 2 #+- 3 4 #-+ 5 6)
(1 2 4 5 6)
>
This will work provided no-one ever puts :+ or :- onto *features*,
which is highly unlikely. (IMHO.)
IMHO, none of these are really good. They are not solutions, they are just hacks that get you around a limitation in Common Lisp.
The better solution is to add something like #; and in principle, this is possible via readtables hackery. However, the fact that #; doesn't get more widely used (like, say, with-gensyms or other similarly simple extensions) could be understood as a sign that readtables hackery doesn't really work that well.
I guess the reason is that there is no good way to integrate readtable extensions / modifications from different sources. ANSI CL requires an implementation to automatically set readtables back after processing a compilation unit (or so), which is a good first step, but doesn't seem to be sufficient.
There should be some kind of MOP for readtables, or something similar, to be able to better define the scopes of readtable extensions and modifications.
And no, I don't have a good and sufficiently worked out idea for that yet...
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.
- Follow-Ups:
- Re: #;
- From: Tobias C. Rittweiler
- Re: #;
- References:
- Prev by Date: Re: self-managed freelist for class instances
- Next by Date: Re: Curses alternative for Lisp?
- Previous by thread: Re: #;
- Next by thread: Re: #;
- Index(es):