guile-devel
[Top][All Lists]
Advanced

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

Re: truth of %nil


From: Neil Jerram
Subject: Re: truth of %nil
Date: Wed, 01 Jul 2009 22:54:50 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Daniel Kraft <address@hidden> writes:

> it seems so.  Doing just a
>
> scheme@(guile-user)> (if %nil 1 2)
> 1
>
> with a recent build (of at least my elisp branch, but that did not
> change anything in this respect of course) gives that answer.
>
> Doing ,o interp #t as Andy did however also gives the right answer for
> me.  BTW, I've just changed my elisp compiler to use real nil instead
> of #f for nil, but now it doesn't have the right semantics of course
> (that's the motivation here).

OK, I see.  The point is that VM ops like br-if use SCM_FALSEP (which
is equivalent to scm_is_false), and hence you're wondering if it would
be easier to change the definition of scm_is_false, than to modify
those ops to say (SCM_FALSEP (x) || SCM_NILP (x)).

I think the balance of arguments is clearly against doing that:

- There are lots of places that use scm_is_false where there is no
  need to allow for the value being tested being %nil.  Changing
  scm_is_false would be a performance hit for those places.

- There are only a handful of places (I think) that you need to change
  to get %nil-falseness in the VM.

- There is a similar number of places which already implement
  %nil-falseness in the interpreter by using (scm_is_false (x) ||
  SCM_NILP (x)), and these would logically have to be changed if you
  made your proposed change.

- It would be an incompatible API change.

So please just change the relevant places in the VM to say
(scm_is_false (x) || SCM_NILP (x)) instead.

Regards,
        Neil




reply via email to

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