Hacker News new | past | comments | ask | show | jobs | submit login

Yeah there are certainly a few bugs remaining in the reader :)

It actually does the right thing if the function is named:

    a = function foo() {}
    /5/
    7
correctly translates to:

    a = function foo() {
    } / 42 / 7;
But clearly I missed the unnamed case. You mentioned finding a few other bugs? Would you mind submitting a bug report on github? I would love to fix those too!



Sorry, was distracted by the other conversation with dherman, and really shouldn't be spending any time on this anyway, but I've verified your operator associativity is wrong.

To start with some example code:

    for (var a = 7 in /7/ in 9 in b);
If I run that in node I get:

    TypeError: Cannot use 'in' operator to search for '/7/' in 9
As this code is vaguely equivalent to:

    var a = 7; for (a in ((/7/ in 9) in b));
However, it gets converted by sjs to:

    for (var a = 7 in (/7/ in (9 in b)));
That's obviously different, and gives this error instead:

    ReferenceError: b is not defined
(I really should get back to actually doing my job now, though; if dherman responds again I'll totally notice and follow up: that conversation is really interesting to me.)


Thanks for taking the time to write these up! I'm tracking them here [1]. The first two should be fixed and I should have the third ready soon.

[1] https://github.com/mozilla/sweet.js/issues/18


function a() { return /7/; }




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: