[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Kawa-commonlisp-dev] 'NIL != '()
From: |
Per Bothner |
Subject: |
Re: [Kawa-commonlisp-dev] 'NIL != '() |
Date: |
Tue, 07 Aug 2012 18:35:12 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 |
On 08/07/2012 06:18 PM, Charles Turner wrote:
Something like, using your repository code:
Object s = LispPackage.currentPackage.get().intern(symname).get(0);
if (s == CommonLisp.NIL_AS_SYMBOL)
s = CommonLisp.FALSE:
return s;
I'm wondering if there's a caveat I'm not seeing to instead just doing
if (symname == "NIL") return CommonLisp.FALSE
instead of interning the symbol.
You have to check that LispPackage.currentPackage.get() is the COMMON-LISP
package *or* one that inherits from it. That seems more complicated
to get right - and most likely slower, at least in the non-NIL case.
where CommonLisp.NIL_AS_SYMBOL is CommonLispPackage.getSymbol("NIL").
Due to the way I understand it, it's easier for me to export the
symbol in CommonLisp, rather than assume it is already an exported
symbol, so I changed that to:
public static final Symbol NIL =
LispPackage.CLNamespace.primExport("NIL");
Well, NIL as a CL value is the same as CommonLis.FALSE, which
is why I used the more verbose NIL_AS_SYMBOL to emphasize this is
not the Lisp value of NIL, but the internal value as a Symbol.
--
--Per Bothner
address@hidden http://per.bothner.com/