Re: pushed updated library tests Marc Nieper-Wißkirchen 01 Sep 2020 07:47 UTC

Am Di., 1. Sept. 2020 um 09:29 Uhr schrieb Alex Shinn <xxxxxx@gmail.com>:

>> >> Given the program
>> >>
>> >> (import (scheme base) (scheme write))
>> >> (define-syntax print
>> >>   (syntax-rules ()
>> >>     ((print a) (begin (write a) (newline)))))
>> >> (print "Hello, World!")
>> >>
>> >> by your reading, "Hello, World!" is not a literal because by following
>> >> the production rules without taking macro expansion into account, you
>> >> will never get to the production rule of <literal>. You will end up
>> >> with <macro use> and be stuck there.
>> >
>> >
>> > The restriction and the entirety of section 7.1 refer to the _lexical_ structure
>> > of the program, well before macro expansion.
>>
>> So, "Hello, World!" is not a literal in my above program in sense of
>> your reading?
>
>
> Of course it is, it's self-evaluating.

Lexically, <self-evaluating> is a production rule in 7.1.3, which can
only be reached through <literal>. But you don't reach the production
rule <literal> if you just look at the lexical structure.

Maybe someone else should try to explain it better than I am
apparently able to, but let me try again: We are talking about two
meanings of "literal" here and what must be meant by the restriction
in 2.4.

(1) "literal" as an expression type.
(2) "literal" as some lexical property of a datum in the source.

My argument is that only (1) makes sense. You seem to want to read
"literal" as in (2). But this will always lead to some contradiction.

First of all, without expanding macro uses, the production rules are
always stuck at a <macro use>. But let's ignore it. Then, by your
answer you gave me about "Hello, World!", every datum of "(quote
<datum>)" or every self-evaluating datum in the source code is
considered to be a literal for (2). This, however, would make the
restriction in 2.4 nonsensical:

(import (scheme base))
(define-syntax strip
  (syntax-rules ()
    ((_ (kwd arg)) arg)))
(strip (quote #1=(begin (display #\x) #1#)))

would then not be covered by 2.4.