-
Notifications
You must be signed in to change notification settings - Fork 378
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
support ES6 features #116
Comments
Yes, this is a project that's on the horizon. It might be huge, and will be tricky as long as the features are non-final and poorly documented. I'm not going to work on it yet, but if you want to, the first thing would be to add an ES6 mode to Acorn that parses at least the stable parts of the new syntax. |
Which is to be closed by acornjs/acorn#110. |
@RReverser note that this is the Tern repository, and your PR adds ES6 support to Acorn. There's going to be a bunch of additional work to be done to teach Tern to understand the new constructs. |
Sure, my reply was rather for
|
What would be the next steps for getting ES6 support in Tern now that acorn is parsing the es6 features? I'd like to contribute in some way if possible, or even put a bounty for this feature. |
There is still need to fix template literals in loose parser which is somewhat more tricky, but in general parser-side is ready. |
Great news and a great job! How can we get it to work? I am using Sublime 3 with TernJS plugin which for now somehow marginally works with ES6 while the tern_for_sublime crashes. Thanks! |
@tomitrescak Tern does not work with ES6 yet, only Acorn (the parser) does. How does tern_for_sublime crash (i.e. what code, what error message)? It shouldn't -- theoretically it should just ignore the things it can't understand. |
Is there any roadmap to support ES6 features? I'm especially interested in classes and module imports. |
Tern starts supporting ES6 with ecma6.json https://github.com/marijnh/tern/blob/master/defs/ecma6.json @marijnh has managed Promise, but ecma6.json must be improved again like Iterator support. But I think Acorn should be customized to support ES6 inside tern. |
I don't really understand why it should be customized to support ES6 differently inside Tern? How is that different from already implemented ES6 support? |
@RReverser I don't know acorn, but with acorn you can set ecmaVersion http://marijnhaverbeke.nl/acorn/#section-4 although inside tern it is never done. I suppose setting ecmaVersion gives features according the version (perhaps acorn is able to support iterator protocal? But perhaps I'm wrong? |
Yes, we are currently not enabling ES6 parsing when calling I will to work on this eventually, but I'll need time and funding. The second can probably be addressed with another crowd-funder, which I intend to start at some point when I am less busy. |
@marijnh I was also just thinking about getting to work on this as soon as finish better loose support in JSX, as I've got some free time, but same problem with 2nd part of your statement :) |
Here's what you can do: Open a bounty on Bountysource for the specific ES6 features you are most interested in. Link it from this issue, and either put money into it right away, or ask me and/or Ingvar what we'd charge to implement it. There's a quite a lot of new stuff in ES6, but if we split it up into smaller features, estimating the cost and raising the funds shouldn't be too hard. |
👍 I've been using sublime code intel which doesn't support ES6. If ternjs supported ES6 I would definitely switch, as it will make coding much more pleasant. I see class support as being the most important here, as it will give the most completions compared to other features. |
Hi all, I've spent the past weeks implementing ES6 support for Tern, including module support. You can see a demo at http://ternjs.net/es6/doc/demo/#ES6 Since giving work away and hoping for the best isn't turning out to be a good way to earn a living, I'm holding the code hostage (not open sourcing it) until the Bountysource item at https://www.bountysource.com/issues/1141202-support-es6-features reaches $2000. If you want to donate towards that sum in another way, contact me. Some notes on the module loader system:
Other ES6 stuff implemented in this branch:
|
Update: Since BountySource doesn't seem to do Euros, I've switched the goal's currency to dollars. (I.e. you just got a 10% off deal). Also, everybody who contributes $30 or more has my permission to start using this code by git cloning |
@marijnh the linked tern-es6 version does not yield any results for anything when I try it with the tern vim plugin. I always only get the emptry string as return value. Have you tested it with the vim plugin ? Are there any kind of breaking changes that would need to be adapted on the vim plugin side ? |
Hi @gilligan, did you |
@marijnh after I append |
@marijnh sometimes it works, apparently rarely though. I will try to work out some minimal test cases |
@marijnh Where I can get the patch? Couldn't find it on GitHub or |
Ah, right, I'm in the middle of a server migration and |
@marijnh asking for bounties is great life check for project, but what will be after $2000 mark? Should it be actually some monthly check to motivate (but not cover all expenses) I guess http://ternjs.net/ should get "Donate" button or this bounty will stay open forever. P.S. it is midnight now. |
I would have to agree. I have already contributed 30USD because that was what I was supposed to pay to for allowance to use the es6 branch. That already felt somewhat "off" to be honest. As you can see I have no issues with contributing something to an open source project, but this should happen organized in a transparent fashion in my opinion. Currently this is the exact opposite. ES6 support is already there and people have to pay to use it. That is just weird. At this point you might as well make it a closed source project and ask me to just buy it. Which I would in fact do (or already did). But you can't have your cake and eat it too. Please don't take this the wrong way, I am merely trying to point out how this is perceived by me and maybe others. It remains your project with which you can do as you please of course. Best, Sent from my iPhone
|
Just for the record, I donated and I don't perceive it that way; I would definitely not donate for a closed source project, because I believe that the benefit an open source Tern would bring to the JS community now that we are getting ES6 can be truly great (ES6 as a language is a lot more amenable to static analysis, but as its new few editors have decent support for it which makes people reluctant to switch). A closed source Tern would not stand a chance of doing that though. |
We've reached $ 1,772 at bountysource and I've recently received another Tern-related contribution outside of that platform that I'm going to count too, putting us over the goal. I've just merged my es6 branch into master, and the ES6 work is now under the MIT license. @gilligan Could you elaborate on your concerns about lack of transparency? I stated exactly what I did, and what happens when my financial goal is reached. You state that you'd prefer for this to be a closed-source commercial project. How would not being able to read, modify, or fork the source benefit you? |
(Please open new issues for shortcomings and bugs found in the ES6 implementation.) |
And I forgot to mention -- there'll be a new release with this code tomorrow. |
Thank you for your hard work and for making tern “open source”. |
@Swatinem Do elaborate what exactly you are perceiving as un-sportmanlike behavior. (And how a copyleft license would have helped.) |
@marijnh It may be in everybody's best interest to lock this thread as it's now a discussion of licenses instead of ES6 support in tern. |
Sorry, I obviously failed at expressing myself. I would certainly not prefer a closed source approach. I have been travelling the whole day and I am deas tired. Will reply properly soon, sorry & g'nite :) Sent from my iPhone
|
I think Marin should be a slave to all of us and have no rights, only Seriously, thanks Marin. I think getting the community to sponsor the work On Sun, Aug 30, 2015, 3:19 PM Tobias Pflug notifications@github.com wrote:
|
Since the trolling is now commencing I will move this elsewhere. You should think about how you communicate. About exaggerations and accusations that abort discussions instead of resolving them by actually having them.
|
@gilligan I was trying to have a discussion, by asking you to clarify your issue. I see no exaggeration or accusation in any of my messages here. I am, in fact, rather pissed off about your tone earlier in the thread, but I am trying to figure out what you mean before jumping to any conclusions. |
Oh i did not mean you at all. And if I have offended you in any way I am sorry since this was not my intention. What I was referring to were messages by people that jumped in drawing black/white pictures while apparently not understanding what I was on about. "OMG This looks to me like someone said something about F/OSS that I don't like. Lets jump in !" I have used open source software all my life, make anything l do open and try to open source things at work. What I was trying to say was...
That being said I did donate and started talking to my employer about supporting the project. It boils down to me (and some colleagues) finding the process a bit odd. I pointed out that it is your project and you can do with it as you wish. Yet I think it is only fair that I'd be allowed to share some concerns. Lets not draw conclusions too quickly and cool down.
|
The strategy of asking people to pay for something they can get for free isn't usually terribly effective (though I'm definitely working on that front too, see my funding page, also linked from the project page). I've found that having some kind of 'carrot' that makes donating attractive can make a huge difference. I do not see how implementing first, then asking for money, is problematic. At least that way you're able to play with the implementation and verify that it works before deciding on whether to shell out for it. |
The difference is exactly the difference between donating and purchasing. By "donating" 30 USD I purchased a license (by shape of your expressed allowance) to use the es6 featured branch in your private repo. I did do this because I am really fond of tern - it is a productivity boost to me - but I find this quite odd. That is the reason why I suggest that you might want to think about a different model if money is a key factor. I have no problem in actually purchasing it. You could still have it on github and/or make it free for non commercial use. So nobody pushed the donate button? Yes, that is what the open source community is like a lot. But your carrot is not just a carrot it hints at the fact that maybe you want/need a different model. So that is what I referred to with the cake analogy. A github repo won't make an income.
|
No, I definitely don't. See also this blog post |
I really don’t want to make this into a flame war of any kind. To reply to @gilligan
I don’ think that statement is true. According to github its the shared work of 59 different contributors (although clearly @marijnh has done most of it) But the statement is also true because of the license. The MIT License basically gives anyone the ability to do whatever they wish with the software, including making a closed source fork and sell it for money. Doing so is just fine by the license, but it sure offends some of the other 58 contributors. It sure would have pissed me off a lot. But alas, I am not one of the contributors. I actually did check out the code some time ago and started implementing a feature without much success and never got around to actually finish it and make it work. But now at least I know not to contribute anything in the future. (Unless I sub-license my fork as GPL, which the MIT license allows me to do) I admire your goal to actually make a living writing open source software and I wish you all the best for it. As in, doing the things you love as opposed to doing the things someone else tells you to. But the point of open source is that it invites others to contribute as well. And Again, I’m very sorry if this might have started a flame war. I will just shut up from now on :-) |
I did not hold anyone's code hostage but my own. The master branch was entirely unaffected by the crowd-funding, and the only new work on the (briefly) non-free branch was my own work. I'm going to lock this topic since I really don't have the emotional energy to deal with this kind of bullshit. |
@marijnh please keep bounty open
Several valuable ES6 features appear to be stable (arrow functions, classes (modulo private members), block scoping) and this month's (May 2013) tc39 meeting seems to be the deadline for a wiki-complete module system spec. Transpilers and engines are already prototyping support, and it is important that tern is not left behind.
If I recall correctly, the esprima and spidermonkey folks have started to agree on the syntax/AST extensions, but tern also needs to take the scoping, typing, and semantics into account (eg desugaring class syntax to ES5 features while keeping ES6 locations).
The text was updated successfully, but these errors were encountered: