[racket-dev] [plt] Push #20578: master branch updated
On Jun 26, Jay McCarthy wrote:
> Just using the core of even-read didn't work. It would start to read
> after parse-statement had returned and then my parser would just sit
> there because the port wasn't returning EOF. I think it is a bug.
I was actually talking about the side-effecting of the parameter.
(And I couldn't even figure out the odd even/odd thing.)
> On Fri, Jun 25, 2010 at 10:44 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Jun 26, jay at racket-lang.org wrote:
> >> + ; XXX This is almost certainly wrong.
> >> + (define (even-read src ip)
> >> + (begin0
> >> + (parameterize ([current-source-name src])
> >> + (datum->syntax #f (parse-statement ip)))
> >> + (current-read-interaction odd-read)))
> >> + (define (odd-read src ip)
> >> + (current-read-interaction even-read)
> >> + eof)
> >> +
> >> + (current-read-interaction
> >> + even-read))
> >
> > This is not just wrong -- it is likely to break things randomly.
> > Something like -- if you happen to invoke the datalog reader
> > indirectly (like just `read' a file in the language), you'd end up
> > with one of these readers as a side-effect. This is exactly how the
> > scribble/text language messed things up in a very confusing way: by
> > banging `current-print' to do its own thing.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!