Am So., 4. Apr. 2021 um 04:26 Uhr schrieb John Cowan <xxxxxx@ccil.org>:


On Fri, Apr 2, 2021 at 3:30 AM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:

My thesis is that we never want incremental extensions to existing syntaxes (unless we are submitting a contribution to an obfuscated code contest). We want global and maybe local extensions (where a global extension can be seen as a local one encompassing the whole source file).

I don't think we are talking about the same thing.  #lang provides a completely separate reader unrelated to any other reader, whereas I am talking about something that adds lexical syntaxes to the Scheme reader (or any other reader, in principle).  

#lang can be used to provide a completely separate reader but in most cases, it will be used to provide the default reader with a dynamically extended read-table. See at the end of this page for an example in Racket: <https://docs.racket-lang.org/guide/hash-reader.html>.

For example, when we import SRFI 160 homogeneous vectors, we would want to also make the associated lexical syntax like #s8, #s16 etc. available both for source code and for data files.  Either of these could be global or per-file.  I call this type "incremental" because it extends the standard syntax with new features; it does not normally redefine existing features.

We have to get it right for source code files first. Data files are, in some way, less problematic because we can always programmatically parameterize the 'read' procedure before reading the file. On the other hand, data files are more problematic when untrusted code is executed. The ability to read data files like those including SRFI 160 lexical syntax must still be there even if executing code while reading data files is turned off.
 
It's true that given #. you don't actually need this: you can write #.(make-s8vector 1 2 3 4).  However, this makes bombs more likely.  It's for this reason that SRFI 10 hash-comma, which is closely related, doesn't accept arbitrary expressions in the pseudo-function position, but well-known identifiers meaningful only to it.  (You can extend them at run time, but not at load time.)

Yes, for general data files, we want to forbid "#.".