Re: (read-from-string "#.(values) 42")



Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx> writes:

2.4.8.6 Sharpsign Dot

#.foo is read as the object resulting from the evaluation of the
object represented by foo. The evaluation is done during the read
process, when the #. notation is encountered. The #. syntax
therefore performs a read-time evaluation of foo.

I think the wording "the object" can be interpreted to mean
the primary value will be used.

Possibly no real program cares what #.(values) does.
However, something like #.(floor 65536 pi) may occur in a program.
The result of reading this syntax may now be undefined in principle,
but implementations agree that only the primary value gets used.
If you modified CLISP to make #. propagate all values,
then such expressions would begin failing:

*** - READ from #<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM>
#<IO TERMINAL-STREAM>>: dispatch macro character definition for #\.
after #\# may not return 2 values, only one value.

So you would have to either remove this check from CLISP
or onerously require users to write #.(values (floor 65536 pi)).

An EXPLICITLY-VAGUE option may be the safest one.
Users who want a specific behaviour can define their own reader macros.
.