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

DEFINED?



   Tomato: mauve
   Date: Wed, 20 May 92 13:59:34 -0400
   From: david carlton <carlton@husc.harvard.edu>
   X-Mts: smtp

   On Wed, 20 May 92 12:42:30 -0400, "Aubrey Jaffer" <jaffer@martigny.ai.mit.edu> said:

   > The addition of the following syntax to Scheme would allow automatic
   > detection of optional features of R5RS.  Currently, optional features
   > are frustrating because one can't use them in portable programs.
   > DEFINED? would allow uniform detection of feature support.

   >    (defined? <symbol>)					syntax

   >  Equivalent to #t if <symbol> is a syntactic keyword (such as IF), has
   >  a syntactic definition or binding (macro) or is a symbol with a
   >  top-level value (such as CAR).  Otherwise equivalent to #f.

   > My intent here is that DEFINED? clauses can be replaced at macro
   > expansion time with #t or #f.  It is also acceptable if DEFINED? of
   > lexically bound variables is #t in the scope of the binding.

   How do you see this as interacting with the following paragraph in the
   standard?

   + Some implementations of Scheme use an initial environment in
   + which all possible variables are bound to locations, most of
   + which contain undefined values.  Top level definitions in
   + such an implementation are truly equivalent to assignments.

   It seems to me that this would totally defeat your purpose of allowing
   automatic detection of optional features of R5RS.

In theory that would certainly blow it out of the water.  In practice,
however, I expect that those implementations use some sort of token
for "undefined value" which could be detected.  Furthermore, all of
the optional procedures would be PROCEDURE? if defined.

If DEFINED? were adopted that paragraph would have to be modified.

   david carlton
   carlton@husc.harvard.edu

	  My EARS are GONE!!
Good thing you have eyes.