-
Notifications
You must be signed in to change notification settings - Fork 2k
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
CS2 Discussion: Features: import/export #4905
Comments
From @carlmathisen on July 22, 2016 6:2 IMO, module syntax should be the import statement from ES6. I totally agree that some of the features in By dropping the It made sense that CoffeeScript had its own class implementation or could have its own module implementation in the old days of ES5, because back then every library or toolset had to cater for themselves anyway. Currently, with ES6, a lot of these features are being consolidated, and it makes sense to support it. |
From @rattrayalex on July 22, 2016 17:7 Welcome @dadleyy and @carlmathisen ! Very happy to have both of you here. @dadleyy raises some interesting points and does so in a well-reasoned way. If nothing else, I certainly agree with this:
I also agree with this:
and expect to use it as a fall-back argument for other such features in the future. Given this effort is likely to result in a major-version-bump at the very least, folks uninterested in the new features are always welcome to use CS v1. |
From @rattrayalex on July 22, 2016 17:10 I hope to respond with more depth later, but off the top of my head, the chief advantages of
Considering a better alternative to Thoughts? |
From @rattrayalex on July 22, 2016 17:14 I would also like to throw out an additional proposal:
The primary motivation is situations when you have a long list of member imports, having the "from" at the end is a little weird: import {
MemberOne,
MemberTwo,
MemberThree,
} from 'my-module'; could instead be: from 'my-module' import
MemberOne
MemberTwo
MemberThree though we'd need to think about what to do when you I'm not convinced this proposal would be worth the departure from ES6 but wanted to share it. Thoughts? |
From @GeoffreyBooth on July 26, 2016 17:45 Full ES2015 module support is, in my mind, the top-priority most-pressing issue facing CoffeeScript today, and the No. 1 reason that people are abandoning it in favor of ES6. I’ve written documentation explaining how to use CommonJS I consider module support to be so urgent that I think it should be built into the current CoffeeScript 1.x, not put off until whenever this new project gets off the ground. The consensus from the various issues in the main repo is that we want to essentially support ES2015 syntax as is, seeing as it’s so coffee-like already; and we would output Someone made a slapdash attempt at implementation in this pull request; I’ve continued a conversation on that thread to try to scope out what a proper implementation would be. I haven’t had much time to work on it, but I’m hoping to get at least a rough draft up on GitHub for others to poke holes in and gradually get polished, and get merged into CoffeeScript 1.x. I wholeheartedly support the idea of CoffeeScript6 and revamping the language for ES2015+ more broadly, but I think module support is so important and so urgently needed that we should make the effort to implement it now in the CoffeeScript we have, even if it means reimplementing it in a new architecture later. |
From @rattrayalex on July 26, 2016 17:57 I agree 100% with @GeoffreyBooth . While I'd love to see @GeoffreyBooth I hope you share your forthcoming PR here at an early stage so that members of this community can contribute. Personally I'd love to take part. |
From @GeoffreyBooth on July 26, 2016 18:11 I’ve been working here. It’s in the very, very early stages: I have failing tests, and I can handle |
From @JimPanic on July 26, 2016 19:2 This is awesome, @GeoffreyBooth and I can only second what @rattrayalex said. I'll have a look at it as well sometime this week. Side note: with working on this PR, we're basically agreeing to do initial work on the original coffeescript codebase and not redux or decaf. Is that correct? |
From @GeoffreyBooth on July 26, 2016 19:13 @JimPanic yes, that’s what I meant about potentially reimplementing this later. I have a hunch that the Redux codebase would likely make a better starting point for the CS6 effort (this is a topic for an entirely separate thread, so let’s please not get into it here) so this PR will likely be the last major new feature in CoffeeScript 1.x, and we’ll have to redo it in CS6. But I think the potential duplication of effort is worth it, to stanch the bleeding of developers abandoning CoffeeScript in the meantime until CS6 can get anywhere close to beta. |
From @JimPanic on July 26, 2016 19:19 Understood and I agree. 👍 |
From @JimPanic on July 27, 2016 9:23 @GeoffreyBooth Oh man, this is kind of a mess. I have the same problem as you: I don't understand how those three files play together. Maybe this is also what the redux codebase was trying to fix. :) I'll continue to try to wrap my head around how all this works… |
From @JimPanic on July 27, 2016 15:17 I managed to get the first two test cases working:
The rest and especially the next one ( |
From @JimPanic on July 27, 2016 17:13 See https://github.com/GeoffreyBooth/coffeescript/pull/2/files |
From @mrmowgli on July 29, 2016 20:28 I would also like to mention that currently Coffeescript/CommonJS and ES6 handle namespaces differently. There needs to be a common way of making sure that both require environments co-exist correctly. In addition to that, and something I've run into a lot with CommonJS loading, is how to handle circular references with require statements. See this issue in Meteor for a good breakdown of this problem: |
From @GeoffreyBooth on July 29, 2016 21:59 @mrmowgli, the plan at least for the PR I'm working on is for CoffeeScript to leave the module handling to downstream tools, just as it does now with _ = require 'lodash' gets output as var _;
_ = require('lodash'); An import statement like: import _ from 'lodash' would get output as import _ from 'lodash'; In other words, just as CoffeeScript relies on other tools to process the |
From @dadleyy on August 1, 2016 15:32 Just updated my original comment on this issue. I'd say its pretty clear we're going to have |
From @GeoffreyBooth on September 17, 2016 2:29 Now that 7667cb2 has happened, I think we can cross this one off the list. One down! |
From @carlmathisen on September 18, 2016 4:42 Thank you all for your hard work on getting import/export support into CoffeeScript! |
From @dadleyy on July 21, 2016 18:1
With the adoption of es6 by many, many, many popular javascript frameworks and libraries, supporting
import
/export
has become very relevant to the adoption of coffescript in the codebases that use those frameworks. This issue has been brought up several times in the original coffeescript repository - see also #3162.At the time of writing this, the
import
andexport
keywords are treated by the coffescript lexer as reserved words and throws a compile-time error when encountered.original comment
Copied from original issue: coffeescript6/discuss#7
The text was updated successfully, but these errors were encountered: