[racket-dev] wrong syntax position and span when using unicode lambda character?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jun 11 20:41:18 EDT 2012

No, Robby meant "on". Line counting matters even more for programs with non-ASCII characters.

On Jun 12, 2012, at 8:07 AM, Stephen Chang <stchang at ccs.neu.edu> wrote:

> Do you mean turn off? I didn't but I will try it. Would it affect some programs but not others though?
> 
> On Jun 11, 2012 8:01 PM, "Robby Findler" <robby at eecs.northwestern.edu> wrote:
> Did you turn out port-count-lines! on the port?
> 
> Robby
> 
> On Mon, Jun 11, 2012 at 6:57 PM, Stephen Chang <stchang at ccs.neu.edu> wrote:
> > I have a drracket plugin that reads the contents of the definitions
> > window as syntax and then traverses that syntax object so that for
> > each subexpression e it prints
> > 1) (syntax->datum e), and
> > 2) the contents of the definitions window at starting at position
> > (syntax-position e) and ending at (syntax-position e) + (syntax-span
> > e)
> >
> > I would expect each subexpression in the program to be printed twice
> > and the plugin generally works as expected, except when I use the
> > unicode lambda character.
> >
> >
> > For example, if I have the program:
> >
> > #lang racket (add1 10)
> >
> > the (add1 10) syntax object correctly has position 14 and span 9 and
> > the add1 syntax object correctly has position 15 and span 4.
> >
> >
> > But for the program:
> >
> > #lang racket (λ (x) x)
> >
> > the (λ (x) x) syntax object has position 14 but span 11 (2 more than
> > expected) and the λ syntax object has position 17 (again, 2 more than
> > expected)
> >
> >
> > Has anyone seen this behavior before?
> >
> >
> > I'll try to distill my plugin to get something reproducible if it's
> > not obvious what's going on.
> >
> > (I think that syntax positions start at 0 and editor positions start
> > at 1 but I account for that so that's not the cause of the problem.)
> >
> > (I'm also aware that evaluating (syntax-span #'(λ (x) x)) in the repl
> > correctly produces 9 so I don't know what's going on.)
> >
> > _________________________
> >  Racket Developers list:
> >  http://lists.racket-lang.org/dev
> _________________________
>  Racket Developers list:
>  http://lists.racket-lang.org/dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120612/ce711c08/attachment.html>

Posted on the dev mailing list.