home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!van-bc!sqwest!dak
- From: dak@sqwest.wimsey.bc.ca (David A Keldsen)
- Subject: Unspecified values in R4RS
- Message-ID: <1993Jan21.195822.23639@sqwest.wimsey.bc.ca>
- Organization: SoftQuad Inc., Surrey, B.C. CANADA
- Date: Thu, 21 Jan 1993 19:58:22 GMT
- Lines: 40
-
-
- In our implementation of Scheme, we've added a special #<unspecified>
- value to be returned from set!, et cetera, to help detect non-conforming
- programs.
-
- Is the behavior:
-
- (define a)
- (let ((result (set! a 'foo)))
- (eq? result result))
-
- => #f
-
- acceptable, legal, and true to the spirit of the language?
-
- The relevant parts of R4RS seems to be: [1.3.2, last paragraph]
- "If the value of an expression is said to be ``unspecified,''
- then the expression must evaluate to some object without signalling
- an error, but the value depends on the implementation; this report
- explicitly does not say what value should be returned."
-
- Furthermore, in [6.2, under the description of eq?]
-
- (let ((n (+ 2 3)))
- (eq? n n)) => _unspecified_
-
- although this must be a boolean, by the definition of
- predicate [6.2, Equivalence Predicates]. This suggests that
- the answer to "Is this behavior OK" is "yes."
-
- How far can we go in helping programmers to detect dependencies
- on undefined return values? Should "unspecified" be a contagious
- quality of Scheme objects, as inexact is for Scheme numbers?
- Are there any papers available on this topic?
-
- Regards,
- Dak
- --
- David A. 'Dak' Keldsen of SoftQuad, Inc. dak@sq.com
- Motto for the day: "Curiouser and curiouser!"
-