[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Kawa-commonlisp-dev] 'NIL != '()
From: |
Charles Turner |
Subject: |
Re: [Kawa-commonlisp-dev] 'NIL != '() |
Date: |
Wed, 8 Aug 2012 02:18:22 +0100 |
Thanks Jamison & Per for the explanation, got myself in quite a knot
with this one (queue rimshot) :-)
On 8 August 2012 00:06, Per Bothner <address@hidden> wrote:
> Basically nil is first resolved to COMMON-LISP:NIL.
> But then "at the last minute" we replace the result by CommonLisp.FALSE.
>
> 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.
> 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");
> For things like property-list access on the symbol 'nil (which I'm
> not sure if is allowed) use CommonLisp.NIL_AS_SYMBOL.
I note that the operation is supported by the various ANSI CL's I have
on my computer.
> Perhaps we need this method:
>
> public static Symbol asSymbol(Object sym)
> {
> return sym == CommonLisp.FALSE ? CommonLisp.NIL_AS_SYMBOL : (Symbol)
> sym;
> }
Good idea, I've used this in various propety-list accessors in
primitives.lisp. Thanks Per, looks like the problem is fixed for now,
I've updated my repository.
I managed to spend 5 minutes wondering why svn diff was spewing forth
such strangeness until I realised I was invoking it from the Kawa
REPL. Think I'll continue my testing after some sleep. :-)
Charles.