satyr/coco

Problem with ranges

vendethiel opened this issue · 3 comments

I get the following error (on cup and with ./coco)

Code: i = 0; x = [1 to i]
Coco: ReferenceError: returni is not defined
As the contrary, LS:

var i, x;
i = 0;
x = [1, 2, 3];

See #65. You need to be a little verbose for that effect: x = (j for j from 1 to i)

ReferenceError: returni is not defined

Smells like a bug. Will fix.

As the contrary, LS:

LS added a shorthand syntax for this particular case, sacrificing some capabilities as the result:

$ coco -bce '[0, 1 to 3]; [f 4 to 6]'
[0, 1, 2, 3];
[f(4, 5, 6)];

$ livescript -bce '[0, 1 to 3]'
Error: Parse error on line 1: Unexpected 'TO'

$ livescript -bce '[f 4 to 6]'
Error: Parse error on line 1: Unexpected 'TO'

(you need to puts "fixes", "fixed" and such) in order for github to automatically close the issue)

thanks !

(you need to puts "fixes", "fixed" and such)

Didn't do that on purpose as this is also a question.