home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / scheme / 2937 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.5 KB  |  50 lines

  1. Newsgroups: comp.lang.scheme
  2. Path: sparky!uunet!van-bc!sqwest!dak
  3. From: dak@sqwest.wimsey.bc.ca (David A Keldsen)
  4. Subject: Unspecified values in R4RS
  5. Message-ID: <1993Jan21.195822.23639@sqwest.wimsey.bc.ca>
  6. Organization: SoftQuad Inc., Surrey, B.C. CANADA
  7. Date: Thu, 21 Jan 1993 19:58:22 GMT
  8. Lines: 40
  9.  
  10.  
  11. In our implementation of Scheme, we've added a special #<unspecified>
  12. value to be returned from set!, et cetera, to help detect non-conforming
  13. programs.  
  14.  
  15. Is the behavior:
  16.  
  17. (define a)
  18. (let ((result (set! a 'foo)))
  19.   (eq? result result))
  20.  
  21. => #f
  22.  
  23. acceptable, legal, and true to the spirit of the language?
  24.  
  25. The relevant parts of R4RS seems to be:  [1.3.2, last paragraph]
  26. "If the value of an expression is said to be ``unspecified,''
  27. then the expression must evaluate to some object without signalling
  28. an error, but the value depends on the implementation; this report
  29. explicitly does not say what value should be returned."
  30.  
  31. Furthermore, in [6.2, under the description of eq?]
  32.  
  33. (let ((n (+ 2 3)))
  34.   (eq? n n))        => _unspecified_
  35.  
  36. although this must be a boolean, by the definition of
  37. predicate [6.2, Equivalence Predicates].  This suggests that
  38. the answer to "Is this behavior OK" is "yes."
  39.  
  40. How far can we go in helping programmers to detect dependencies
  41. on undefined return values?  Should "unspecified" be a contagious
  42. quality of Scheme objects, as inexact is for Scheme numbers?  
  43. Are there any papers available on this topic?
  44.  
  45. Regards,
  46. Dak
  47. --
  48. David A. 'Dak' Keldsen of SoftQuad, Inc.    dak@sq.com
  49. Motto for the day:  "Curiouser and curiouser!"
  50.