Problem with ranges #143

Closed
vendethiel opened this Issue Jun 25, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

vendethiel commented Jun 25, 2012

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];
Owner

satyr commented Jun 25, 2012

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'
Contributor

vendethiel commented Jun 25, 2012

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

thanks !

@vendethiel vendethiel closed this Jun 25, 2012

Owner

satyr commented Jun 25, 2012

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment