[r6rs-discuss] [Formal] Syntactic datums and datum values
If you look at an earlier thread you can see that I also was (and still
am?) confused by this. I think some clarification is needed.
> It is not stated what this means. I guess maybe it means that writing
> out
> (1 2 3) and reading it back in during the same run will give a value
> that is equal? to the original. Is that correct?
Yes.
>
> * Several syntactic datums can
> represent the same datum value,
>
> I'm unsure what is meant by this. For example, do the two 1s in (cons
> 1 1) count as distinct syntactic datums that may represent the same
> value, or does this only refer to the fact that 1.0 and 1.00000 may
> represent the same value (as stated in chapter 3)?
>
Syntactic datums are just strings of characters. So yes the strings "1"
are the same.
> * but the datum value corresponding to a
> syntactic datum is uniquely determined.
>
> I also find this confusing. Clearly this cannot mean uniqueness with
> respect to eq? Does this mean uniqueness with respect to equal? ?
> Or could the two syntactic datums in (cons "abc" "abc") represent
> different datum values (given that they are considered as separate
> syntactic datums, which is unclear)?
I think you are on the wrong track here. Syntactic datums and datum
values are not Scheme objects/values, and it makes no sense to apply
Scheme function to them.
>
> Chapter 3 (introduction) says:
>
> * A syntactic datum can be used in a
> program to obtain the corresponding value using quote.
>
> What is meant by "the"?
_The_ (unique) datum value corresponding to a syntactic datum is
described by grammar and text spread out over chapter 3.
>
> * Moreover, valid Scheme expressions form a subset of the syntactic
> datums.
>
> Is this actually true? I believe that there are valid Scheme
> expressions represented by syntax objects that are not syntactic
> datums as described by
> the grammar of this section. For example, macro-generated Scheme
> expressions may be valid only if identifiers are interpreted as
> entities containing substitutions/renamings. If this extra data is
> removed, the expression would cease to be valid.
I think "Scheme expression" here is to be interpreted as the program
text before any macro expansion.
>
> Also, is the intent to talk only about expressions or forms?
>
> * Note that several syntactic datums may represent the same object, a
> so-called
> datum value. For example, both "#e28.000"
> and "#x1c" are syntactic datums representing the exact integer 28;
> The
> syntactic datums "(8 13)", "( 08 13 )", "(8 . (13 . ()))" (and
> more) all
> represent a list containing the integers 8 and 13.
>
> This paragraph promises to illustrate syntactic datums that represent
> the same object. However, I believe the language "the same object" at
> least strongly suggests eq? to many Schemers. However, the examples
> are of syntactic datums that give rise to objects that may not be eq?
I agree, "same" implies "eq?" for me too. And here the report actually
talk about objects.
>
> The next line says:
>
> * Syntactic datums that denote equal objects are
> always equivalent as forms of a program.
>
> Perhaps changing equal to equal? may clarify what is meant by this (if
> it is in fact true - see comment about syntax objects above).
>
Michael Sperber already agreed to add a reference to "equal?" here.
> * A syntactic datum occurring in program text is often called a form.
>
> Does this mean that the datum (x 1) in (let ((x 1)) x) is a form? How
> about
> the 1 in (display (quote 1))?
>
Pass. (I think the answer is "no" but I prefer if someone else fill in.)
>
> Section 4.8 says:
>
> * It is desirable for constants (i.e. the values of literal
> expressions) to
> reside in read-only-memory.
>
> I assume that the term "constant" here refers to what is called "datum
> value"
> in section 1.9. If so, it may be better to use the same terminology.
>
No not the same as datum value. Of the following three expression the
first to are "literals" but the third is not. All are datum values.
"abc"
(quote (1 2 3))
(list 1 2 3)
To sum up my understanding of the issue: "Syntactic datums" are just
strings of characters as defined by the grammar. "Datum values" are
something more abstract, described only indirect via a function from
syntactic datums. Datum values can be "instantiated" as Scheme values,
for example with "quote" or by using the "read" procedure. No all Scheme
values have a corresponding datum value, for example a circular list.
/Mikael
Received on Mon Mar 12 2007 - 04:14:51 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC