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

DEFINED?



   Date: Wed, 20 May 92 16:41:04 -0400
   From: "Aubrey Jaffer" <jaffer@martigny.ai.mit.edu>

      Date: Wed, 20 May 92 10:11:40 pdt
      From: Morry Katz <katz@sid.stanford.edu>
      Reply-To: katz@cs.stanford.edu

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

	 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.

      The top-level restriction is problematic in that many inplementations
      do not have a concept of top-level.

   That is addressed in this next paragraph:

	 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.

      I believe that much more than defined is needed to use optional
      features.  One also needs to know the arity of a form an dpossibly
      clues as to its semantics.  

   There are only 5 procedures with options on number of arguments:
   make-vector, make-string, apply, -, and /.  

Yes, but given implementation might include many others for which one might
want to test usind defined?

   I have already proposed
   making multiarg apply essential.  The are all easily written in
   Scheme.  In fact SLIB has code for multiarg -, /, and apply.  The
   arity question is a small part of the uncertainty.  As for clues to
   its semantics, if an implementation is not compliant with the report
   then how can one expect it to support clues?

      I might support a more limited proposal that just allowed for testing
      of the existance of optional features in the report.

   When you say features I gather that you mean more than just syntactic
   keywords and procedure names.  I resist this because it will require
   naming and implementing each switch.  With DEFINED? it would be
   automatic.  How about this as a compromise:

Sorry, I chose inappropriate wording.  I should have said essantial vs
nonessantial functions and syntax.

	   The value of DEFINED? is specified only for arguments
	   which are syntactic keywords or procedures in R5RS.

--------------------
Morry Katz
katz@cs.stanford.edu
--------------------