[r6rs-discuss] #!fold-case and #!no-fold-case
William D Clinger wrote:
> Alan Watson wrote:
>
>> Would it be worth having #!r6rs return a value? Perhaps an unspecified
>> value? Perhaps the symbol whose spelling is #!r6rs? (Note that this
>> symbol need not be an identifier.)
>
> Yes! Perhaps. Perhaps again, although I don't see why the
> R6RS should care.
Hmm. One problem with my suggestion that it return a symbol whose
spelling is #!r6rs is that one might have an ambiguity with the same
symbol written using hex escapes. (Ditto below for #!fold-case and
#!no-fold-case.)
>> I have to wonder if #!fold-case and #!no-fold-case would not be better
>> replaced by appropriate R5.91RS-like declarations. The scope would be
>> clearer.
>
> The problem is that #!fold-case and #!no-fold-case affect
> the lexical syntax, which means they have to be detected
> and acted upon during the read phase, which normally comes
> before the macro-expansion phase that would be the first
> to see the declarations. By the time macro-expansion gets
> under way, it's too late for a #!no-fold-case to undo the
> effect of a #!fold-case. (It might not be too late for
> #!fold-case, but both need to work.)
This depends whether you want case-folding to work for ANY data read
using read or just for programs and libraries. That is, does #!fold-case
change the behaviour of read or the compiler?
The appendix talks about "case-insensitive syntax", and I interpreted
this as "case-insensitive LEXICAL syntax FOR PROGRAMS" not
"case-insensitive LEXICAL syntax FOR DATA". If the intent really is that
these directives work for data, perhaps this should be clarified. Or
perhaps I'm just being thick.
If we only need this behaviour for libraries and programs, then
declarations would be fine. One would simply add a pass to the compiler
after read but before the macro expansion that folded case as appropriate.
Regards,
Alan
Received on Wed Jun 27 2007 - 13:32:51 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC