This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SCM_UNBNDP


Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:

> In tags.h, SCM_UNBNDP is defined as a comparison against SCM_UNDEFINED,
> but there is no SCM_UNDEFINEDP (or SCM_UNDEFINED_P) predicate.  I am not
> sure about what concept is to be understood by 'unbound' in contrast to
> 'undefined'.  Hoever:
> a) If there is a distinction then we should provide an additional macro
>    SCM_UNDEFINED_P in order not to encourage programmers to use SCM_UNBNDP
>    just to compare against SCM_UNDEFINED.
> b) If there is no distinction, then we should use SCM_UNDEFINED_P instead
>    of SCM_UNBNDP, because otherwise the asymmetry between the names is
>    confusing.
> 
> If nobody objects, I will add a SCM_UNDEFINED_P macro to tags.h.

As far as I remember now, there are two situations when you use
SCM_UNDEFINED and SCM_UNBNDP in Guile:

* To indicate/detect an unbound variable

* To indicate/detect an unbound procedure argument

Since both is about detecting something unbound, SCM_UNBNDP or maybe
SCM_UNBOUND_P seems OK.

But, probably, SCM_UNDEFINED_P is unmotivated since it is not
interesting to indicate that you want to check if a value is
undefined.

The asymmetry comes from the fact that the unbound-ness of a
"location" is indicated by storing an undefined value in it.

Checking if a location is unbound therefore amounts to checking if it
has an undefined value stored in it, but the latter is a lower level
of description.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]