[gambit-list] Is (void) distinct from all other types?

Mikael mikael.rcv at gmail.com
Fri Oct 28 08:07:20 EDT 2011


2011/10/28 Vok Vojwo <ceving at gmail.com>

> Is (void) distinct from all other types?
>

It's a unique value yes. (void) => #!void . (eq? (void) #!void) => #t .  (if
#f #t) => #!void . (member #!void (list #f 0 "" '() #!unbound (not #!void)))
=> #f .

Is this a proper way to check if anything is undefined?
>
> (let ()
>  (define a)
>
 (eq? a (void)))
>
I think (define a) does not conform to RnRS, because define requires
> two arguments. Is there a RnRS conforming way to check if anything is
> undefined/unspecified?
>

Don't base your code on checks for if variables are not defined, it reflects
bad coding practice (as it doesn't deliver on transition into local scopes
and it renders optimizations ineffective), so reconsider what you want to
achieve and how. The B.H. module system does not use anything like this
afaik, for instance.

You could do (eval varname-symbol) though, exception shows it didn't exist.
For more sophisticated introspection of globals, you could check out
Gambit's internal structures for this.

There is a #!unbound value also, that comes into play in some circumstances.


> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20111028/69a83c3f/attachment.htm>


More information about the Gambit-list mailing list