[R6RS] R6RS Unicode SRFI controversial issues

Anton van Straaten anton
Sun Jun 19 13:31:56 EDT 2005


Michael Sperber wrote:
> Anton van Straaten <anton at appsolutions.com> writes:
> 
> 
>>One observation about the here-string syntax as proposed above: 
>>Perl-style here-strings (see e.g. [1]) support code like this:
>>
>>  $data = foo(<<THING, arg2, arg3);
>>  This is a long quoted line.
>>  THING
> 
> 
> How is the beginning of the string determined?

I believe the usual approach is that the string begins on the line 
following the token which introduces it.  I.e. the rest of the line 
after the token is parsed as normal code, and the string begins after 
the newline.

>>IIUC, the Scsh/Gambit approach would require something more like this:
>>
>>  (set! data (foo <<THING
>>  This is a long quoted line.
>>  THING
>>  arg2 arg3))
> 
> 
> I think you should have written this
> 
> (let ((arg1 <<THING
> This is a long quoted line.
> THING
>       ))
>   (set! data foo arg1 arg 2 arg3))
> 
> (As with any longer or more complex argument.)

The Scsh/Gambit approach would require this in every case.  However, the 
usual here-string approach provides a kind of positional abstraction 
already, with an identifier involved.  In my example:

(set! data (foo #<<THING arg2 arg3))
This is a long quoted line.
THING

When you see "#<<THING", you know you need to look on the next line for 
the data which it references.  The data has already been extracted from 
the source location which references it.  There's no need to abstract it 
further by binding an ordinary lexical name to it, unless you need to 
reuse the string, or define it a greater distance from where you use it.

It's a convenience.  It's much more important to have support for 
multiline blocks of unescaped text, though, with or without this 
convenience.

Anton


More information about the R6RS mailing list