Re: [Scheme-reports] Some comments after reading the r7rs public draft
John Cowan 11 Jun 2012 03:57 UTC
Alex Shinn scripsit:
> Chibi-scheme allows implicit forcing as a compile time option (probably
> eventually to be a language-level option), and has a formal definition
> of which primitives can and can't perform implicit forcing.
Is this written down anywhere? I wasn't able to find it. Anyway,
here's my view (which is also a comment on the ticket):
1) Procedures whose arguments belong to specific types should be allowed
to force promises to see if the value of the promise belongs to that type.
That covers `cdr` and `+` and the great majority of standard procedures.
2) The type-identifying predicates
`number? complex? real? rational? integer? boolean? pair? null? list?
symbol? char? string? vector? bytevector? procedure? error-object?
input-port? output-port? textual-port? binary-port? port? eof-object?`
should likewise be allowed to force promises, given that promises are
not a disjoint type and there is no way to identify one. So `number?`
should be allowed to return `#t` either on a number or a promise whose
value is a number.
3) The constructors `cons list vector`, the pseudo-constructor `values`,
and the mutators `set-car! set-cdr! list-set! vector-set!` should *not*
be allowed to force promises. A promise is an object, and it should be
possible to put it into a data structure without forcing it. Likewise,
the keyed accessors `memq memv member assq assv assoc` should be able
to retrieve a promise from a list.
4) I don't have a good intuition about he remaining procedures that
accept arbitrary objects. They seem to fall into these groups:
a) `make-promise`: what happens if the argument is already a promise?
The draft doesn't say.
b) the equivalence predicates `eq? eqv? equal?`: should promises be
distinct from their values?
c) `not`: can a promise whose value is `#f` count as false?
d) the error procedures `raise raise-continuable error`: what's to
be done?
e) the output procedures `write write-simple display`: what's to be done?
f) `exit`: what's to be done?
g) `list-copy`: the argument is normally a list, but can be an arbitrary
object (a degenerate case of an improper list) in which case it returns
the object.
--
John Cowan cowan@ccil.org http://ccil.org/~cowan
Promises become binding when there is a meeting of the minds and consideration
is exchanged. So it was at King's Bench in common law England; so it was
under the common law in the American colonies; so it was through more than
two centuries of jurisprudence in this country; and so it is today.
--Specht v. Netscape
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports