Re: define-reader-ctor is merely an implementation hint
Richard Kelsey 05 Oct 1999 19:25 UTC
Date: Tue, 5 Oct 1999 18:42:45 GMT
From: xxxxxx@pobox.com
> The only way to supply contructor functions in SRFI-10 is by doing
> (define-reader-ctor <symbol> <proc>).
No. The only requirement SRFI-10 mandates is that "There must be a way
to declare an association between a symbolic tag and the corresponding
constructor-procedure." SRFI-10 goes on to _suggest_ that an
implementation may want to implement a define-reader-ctor function for
that purpose.
This was not at all clear to me from reading SRFI-10. I suggest
that you make it much more explicit. You could say something like:
"An implementation of SRFI-10 must provide some method for
associating symbolic tags with constructor procedures. For
example, it might provide a `define-reader-ctor' function for
that purpose."
I admit SRFI-10's normative silence about precise ways to
define reader-constructor associations may sound like a cop-out. Yet
is is intentional: the purpose of SRFI-10 is to extend the _protocol_
by which a Scheme system communicates with an external world. If my
and your applications run by a SRFI-10-compliant system, and I send
you a string
"#,(f32 1.0 2.0 3.0)"
then you know what I am trying to say. What you're going to do about
this -- reject or accept my request for constructing a value -- is
another matter entirely.
No, I have no idea what you are trying to say, because I have no
idea what procedure `f32' refers to.
I don't think SRFI-10 is way out of the line in this
respect. For example, SRFI-0 talks about feature identifiers -- yet it
gives no details how an implementation happens to have these
identifiers defined, and how a user may extend the system with more
identifiers (if he can at all).
But SRFI-0 does say what each feature identifier means: it means that
the feature in the associated SRFI document is present. If I see a
program like
(cond-expand ((and srfi-1 srfi-17)
(write 1))
(else))
then I know to look at the SRFI-1 and SRFI-10 documents to find out
what the program means. If I see
#,(f32 1.0 2.0 3.0)
in a program all I know is that the value will be the result returned
by applying some arbitrary function to `(1.0 2.0 3.0). This doesn't
tell me very much about what the program means.
-Richard Kelsey