guile-devel
[Top][All Lists]
Advanced

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

Re: %nil once again


From: Daniel Kraft
Subject: Re: %nil once again
Date: Sun, 19 Jul 2009 21:44:14 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070425)

Hi Neil,

Neil Jerram wrote:
Daniel Kraft <address@hidden> writes:

scheme@(guile-user)> (null? %nil)
#f
scheme@(guile-user)> (equal? %nil (cdr (list 1)))
#f
I believe those work in the interpreter, and so are VM bugs.  Can you
check that with ,o interp #t ?
The first one is indeed #t with the interpreter, the second one
not. But unfortunatly I think that the elisp equivalent of

(equal?/eqv?/eq? (cdr (list 1)) nil)

(don't know which predicates take the place of eq?/eqv?/equal? in elisp yet) should indeed yield true, as a perfectly valid way to check for (null? (cdr (list 1))), right? So it seems that in this case even the Guile interpreter does not handle empty lists as it should for elisp -- or don't we need to ensure that test is true?

Hm, interesting point.  Is it a problem in practice though?  If so,
what is the practical context?

i.e. is there a lot of existing code that uses (equal ... nil) to test
for the end of a list, rather than (null ...) ?

honestly, I don't know (but think in practice null shoud be used).

So no need for ensuring myself that
all '()'s get replaced by %nil's?

I would say not - because much of the existing Scheme/Elisp design is
based on _not_ having to translate data as it passes between
languages.

Good, that sounds reasonable and is also what I suggest. If we are one day able to actually run existing elisp code through Guile, we'll find out if anything needs to be changed in order to get a usable implementation anyways.

BTW, I implemented also the function bindings of symbols using this fluid-based dynamic scoping at the moment -- but on second thought, there's no scoping at all for function slots (all are global), is there? If this is true, we can get rid of this complication here and use the symbols in (language elisp runtime function-slot) directly without indirection via the fluids.

Yours,
Daniel

PS: Current status update (should mainly be pushed already): Yesterday I implemented compiler handling of backquoting and a lot of new built-ins (mainly list stuff like cons, car/cdr or number-sequence). Currently I'm working on some "derived" control-structures (prog1, prog2, when, unless, dotimes, dolist), and then a lot of the basic stuff will already be in place. However, there isn't yet a real elisp-reader, so maybe this is the next big project (but I can try to make use of the existing patches).

--
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri




reply via email to

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