-
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
class B extends A
calls A.extended(B)
when A.extended
is a function
#516
Comments
Mind pasting an example of the JavaScript you'd like to generate for this? Something along these lines?
Or do you think there needs to be a check to ensure that it's a function? |
For what it's worth, I am strongly in favor of this callback. It would be similar to Ruby's Class::inherited method (http://ruby-doc.org/core/classes/Class.html#M002785), and provide a very useful metaprogramming capability that is not otherwise possible to implement. |
+1 to this. In general, I'd like to see CoffeeScript classes become more powerful constructs. And the test case example is awesome. |
Here's my proposal. We'd only call |
sstephenson's patch is now merged to master. Closing the ticket. |
very cool! |
I've just been pointed to this ticket from: #1762 ...what do you guy's think this? |
It'd be useful if CoffeeScript could invoke a callback on a class after it's subclassed with the
extends
keyword.With such a callback, you could implement a base class that propagates its class methods to subclasses:
You could also implement a test case class that collects its subclasses and runs them automatically:
The text was updated successfully, but these errors were encountered: