I see that the documentation for Racket's `read` and `read-syntax`
needs to be adjusted to say that the values of various parameters are
relevant only when the `read` or `read-syntax` starts. (Trying to make
them adapt dynamically in general would be impractical, I think; a
custom port's byte-reading callback could adjust a parameter's value on
every byte, and it would be difficult to specify the effect of those
changes.)

Without modifying the reader, I think you'd have to adjust the
readtable for everything that potentially starts a symbol, and then
parameterize a recursive read in those cases. That approach might not
be too bad, since a readtable supports a mapping for the fall-through
case, but I haven't tried it.

At Mon, 2 Nov 2015 15:34:33 -0800, Alexis King wrote:
> Hi all,
> 
> I’m continuing to implement R7RS in Racket, and I think I’ve gotten most of 
> the way aside from the various reader differences. The trickiest thing seems 
> to be the #!fold-case and #!no-fold-case directives, which adjust the 
> case-sensitivity of the reader as a side-effect. I’ve implemented a readtable 
> dispatch macro on the exclamation mark, and I’ve been able to successfully 
> read these two directives.
> 
> Unfortunately, when I mutate read-case-sensitive by calling 
> (read-case-sensitive #f) from within my readtable action, it doesn’t seem to 
> persist this change to the next datum. However, the parameter is definitely 
> getting set, because I get this error message:
> 
>    #!fold-case
>    DISPLAY
> 
>    => DISPLAY: unbound identifier in module in: |DISPLAY|
> 
> The identifier in the error message is being escaped with |vertical bars|, as 
> would be the case if case sensitivity were turned off. Unfortunately, it 
> doesn’t seem to be affecting the symbols that actually get read.
> 
> What’s the “proper” way to adjust this parameter dynamically as I read the 
> program?
> 
> Thanks,
> Alexis
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to