-
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
fixes #841: bring back the extended
hook
#1960
fixes #841: bring back the extended
hook
#1960
Conversation
Thanks for the implementation -- we should definitely decide this one way or another before 1.2.1, but let's not merge this quite yet... |
Of course. |
@jashkenas: we're going to need another release soon (a new minor version), so how are we going to handle this? I say we merge it. |
+1 |
+1 |
1 similar comment
+1 |
+10 |
I had a nice long chat with @wycats about Ember's need for the extended hook, and I'm afraid I persuaded myself that we shouldn't do it. There are good arguments for running
... or many other possible uses of dynamic hooks during class definition. Hard-coding a single |
I can accept that reasoning. Thanks for looking into this. |
We also discussed the possibility of adding in a compiler hook so that it would be easier to maintain an Ember variant of CoffeeScript without forking the entire project. Thoughts? |
My extended use case would also work with a compiler hook. |
I think in this case you'd just want a finer-grained breakdown of the "class" compilation function in nodes.coffee ... then you'd have (ideally) a single function to override. It's not an "events" thing, I don't think. |
I'd optimally want to be able to subclass the compiler and override some hooks, rather than try to do something with events. |
I'm doing some terribly awful things to coffeescript and "classes" https://github.com/collin/pathology I would also like to be able to flip some switches and override the 'class' part of the compiler. But I think it's potentially a recipe for sadness. Say if I want to use two libraries that need to compiler overridden in different incompatible ways. What are the use cases for class extension hooks other than wrapping around the class body? I can see re-opening a class, but not much else. |
What about |
I think a better hook would be This would allow for extensions that hook before extension, after extension and allow for re-opening of classes. @jashkenas you mention other scenarios that you don't want to trample on, I'd like to know what those are in case I'm completely missing the boat on this. |
+10 Adding a compiler hook would be ideal so as to avoid creating a custom fork of coffeescript that does something like: https://gist.github.com/2365817. |
@jashkenas @wycats what do you think of this? https://github.com/d4tocchini/coffee-script/blob/master/src/nodes.coffee#L1990 Exploring a minimal set of hooks for extending CoffeeScript. |
Thanks @viatropos. The A more generalized mechanism for extending the compiler would be awesome. |
I say we go for it.