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
Add ->* and yield #462
Add ->* and yield #462
Conversation
@@ -1623,6 +1623,10 @@ class exports.Fun extends Node | |||
o.indent += TAB | |||
{body, name, tab} = this | |||
code = \function | |||
if @generator | |||
if @ctor | |||
@ctor.error "A constructor can't be a generator" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(fixed in my local repo)
🍰 |
🍰 WONDERFUL DAY |
Well done! On Fri, Jan 31, 2014 at 12:19 AM, Mathieu Gallé-Tessonneau <
|
I'll try to get travis setup correctly tomorrow |
Awesome! Thanks for your work :) The syntax looks good. Once this gets merged in I'll look into releasing 1.3. |
Mostly ready. Needs a special setting for travis -- @gkz do you know how ? Didn't add |
@gkz There doesn't seem to be a way for travis to run a certain command only on a certain platform (that I've found). Should be okay other than that. |
hmm, you're right, which is why I want to think about it more. I don't want to remove functionality from the generators, just to make them easier on the eyes for basic patterns. I'll have a clearer idea in a few days, as I'm still getting used to to new concepts. I think, if you put engine node: ">= 0.11.3" it will run the tests on node with harmony (like so: https://github.com/cojs/archan/blob/master/Makefile), but, I think npm will give you a warning if you try to install on 0.10.x so that's not optimal.
and then in the test script just do a conditional which checks the node version and if it's 0.11.x run the harmony tests as well. I recommend separating these tests out into a separate file and spawning a node process with I'm pretty sure I can get it working. do you want me to make a PR? |
Thinking about the |
I started off with that, but it would double code here : https://github.com/gkz/LiveScript/blob/master/src/lexer.ls#L593 |
whatever... it's just a test. I think it's actually better to do the whole test suite utilizing with both harmony enabled and disabled (make sure harmony doesn't break something).
|
Isn't it possible to add the |
yes, it is, but you wouldn't want that in some cases. imagine this:
which if you combined this with a package like
which is sorta the stuff I was thinking about for making the language better |
I request we rename LiveScript to "Arrow" |
Let's work on branch: |
How about: |
Or even: |
So who's gonna fork LiveScript to presume every function is a generator? Does that even make sense? |
"wip"
Adds a basic version of generators. Tests courtesy of @alubbe.
What's (could be) missing :
yield from
~~>*
class => ->*
(currently has an error, fixed on my local repo) (also for!->*
if we go the hushed route)Questions :
function
)