kawa-commonlisp-dev
[Top][All Lists]
Advanced

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

Re: [Kawa-commonlisp-dev] Internal symbol representation


From: Charles Turner
Subject: Re: [Kawa-commonlisp-dev] Internal symbol representation
Date: Sat, 28 Jul 2012 20:19:45 +0100

On 27 July 2012 23:44, Per Bothner <address@hidden> wrote:
> My understanding is that (eq 'CL:DECLARE 'CL-USER:DECLARE)
> when the current package is COMMON-LISP-USER.

I would expect 'CL-USER:DECLARE to fail because it is not an external
symbol of CL-USER.
I have this
#|kawa:92|# *package*
#<PACKAGE "COMMON-LISP">
#|kawa:93|# (find-symbol "CAR")
CAR :external
#|kawa:94|# (in-package "CL-USER")
#<PACKAGE "COMMON-LISP-USER">
#|kawa:95|# (find-symbol "CAR")
COMMON-LISP:CAR :inherited

And this:

(*package* := CL-USER)
#|kawa:3|# 'cl:car
COMMON-LISP:CAR
#|kawa:4|# 'car
COMMON-LISP:CAR
#|kawa:5|# (eq 'cl:car 'car)
t


> I.e. the reader resolves declare to CL-USER:DECLARE but since
> CL-USER "uses" CL is the symbol resolves to the (existing) one in CL.

If in package CL-user, the reader will resolve 'declare to CL:DECLARE,
not sure what you mean about resolving to CL-USER:DECLARE

>> #|kawa:589|# '(declare (type integer fnard))
>> (DECLARE (TYPE integer FNARD))
>
> That is weird - who is integer lower-case?

That's a buglet, it's because for now I'm borrowing the types from
EmptyNamespace. When I search EmptyNamespace, I downcase the argument,
and when it comes back from the lookup, that's how it is. Shouldn't be
very hard just to alias them somehow with a nice ALL-CAPS equivalent
:) But I quite like the syntactical distinction between names in CL
and those from other parts of Kawa:

#|kawa:6|# '(defun define syntax-case car)
(COMMON-LISP:DEFUN define syntax-case COMMON-LISP:CAR)

I'll probably receive a slap on the wrist from ANSI though.

> Both are correct: The package prefix
> is ellided when the symbol is "accessible" in the current package.
> However, toString should print without checking the current package,
> or at least that seems reasonable.

Currently (and I realise it's ANSI wrong) the namespace is only elided
when the symbol is either internal or external to the package you're
currently in. If it's an inherited symbol, then the prefix is not
elided. Easy to fix, but I prefer this behavior for now whilst I'm
still doing exploratory debugging. I'm also checking the current
package in toString, not sure which I prefer, I think suggestion
matches the intuition of what a symbol's name is, rather than the more
pedantic version I currently am  using IIUC.

I *finally* finished the tagbody thing. For hours I thought I was
doing the tail recursion wrong somehow... It turned out that I'd
blissfully copied the following from SBCL (yeah we should use AND
instead, they don't have it at this point):

(if (stringp x)
    (if doc-string-allowed
        (if remaining-forms
            (if doc
                (error "duplicate doc string ~S" x)
                t))))

I'd a priori assumed IF would only ever default to false... Why does
kawa default to #!void? That seems quite crazy! If we don't support
missing an else expression, perhaps that should be a syntax error. If
we do, then I think we should return #f. That's probably going to be
another cross-language issue as well :(

Charles.



reply via email to

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