This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: SCM_UNBNDP
- To: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Subject: Re: SCM_UNBNDP
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 29 Mar 2000 13:14:35 +0200
- Cc: Guile Mailing List <guile at sourceware dot cygnus dot com>
- Cc: djurfeldt at nada dot kth dot se
- References: <Pine.LNX.4.21.0003291202080.20677-100000@marvin.ida.ing.tu-bs.de>
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.