Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with ranges #143

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

Problem with ranges #143

vendethiel opened this issue Jun 25, 2012 · 3 comments

Comments

@vendethiel
Copy link
Contributor

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];
@satyr
Copy link
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'

satyr added a commit that referenced this issue Jun 25, 2012
@vendethiel
Copy link
Contributor Author

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

thanks !

@satyr
Copy link
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
Projects
None yet
Development

No branches or pull requests

2 participants