[R6RS] R6RS Unicode SRFI controversial issues
Anton van Straaten
anton
Tue Jun 21 18:00:12 EDT 2005
Michael Sperber wrote:
> Anton van Straaten <anton at appsolutions.com> writes:
...
>>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.
>
>
> Huh. My gut tells me this is a total hack, yet my brain doesn't seem
> to be able to poke an honest hole in it, other than the complications
> in implementing the reader. Does it scale to multiple arguments?
>
> $data = foo(<<THING1, <<THING2, arg3, arg4);
> This is the value of THING1
> THING1
> This is the value of THING2
> THING2
Yes, that's exactly how it works, in Perl at least.
BTW, I notice that PLT v299 also supports the scsh-style syntax, and
Guile has it as a module (part of a Scsh port).
I think the hackish feel of the full Perl-style mechanism comes mainly
from being un-Scheme-like. It allows separation of the literal text
from the place where the text is used, in a way that's unlike anything
else in Scheme.
OTOH, the scsh mechanism only allows strings to be quoted in-place, so
is just a special kind of literal string quotation that isn't
particularly surprising in a Scheme context.
Despite the initial surprise of the Perl style, though, I think it could
be useful in making s-exps cleaner, for example:
Scsh-style:
(let ((thing1 #<<THING1
This is the value of THING1
THING1
)
(thing2 #<<THING2
This is the value of THING2
THING2
))
; use thing1 and thing2 here
)
Perl-style:
(let ((thing1 #<<THING1) (thing2 #<<THING2))
This is the value of THING1
THING1
This is the value of THING2
THING2
; use thing1 and thing2 here
)
But as I said, I'm much more interested in having support for blocks of
unescaped text, than I am in the exact syntax or features used to
achieve that.
Anton
More information about the R6RS
mailing list