[plt-dev] reader
On Mar 23, 2010, at 5:40 PM, Matthew Flatt wrote:
> At Tue, 23 Mar 2010 17:13:42 -0400, Matthias Felleisen wrote:
>> Save the program below
>
> As "foo.ss", I assume...
>
>> and run. See surprising error message. Change
>> language to #lang scheme and see same surprising error message. Why?
>
> When you call `read', you generally don't expect arbitrary code to
> run.
> Since `#reader' and `#lang' can make the reader load arbitrary code,
> they're disabled by default. (They're specifically enabled for reading
> code via `require' or `load'.)
>
> To allow `read' on a module source, parameterize `read-accept-reader',
> as in this "foo.ss":
>
> #lang scheme
>
> (parameterize ([read-accept-reader #t])
> (with-input-from-file "foo.ss" read))
Yes, I know. I should have said "I find the error message
confusing and wish it explained more, especially for ASL."
-- Matthias, too busy to write reasonable emails.