-
Notifications
You must be signed in to change notification settings - Fork 157
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
use full ClassName.prototype.memberName #853
Conversation
f5c7178
to
4d01965
Compare
A.prototype.one A.prototype.two | ||
B.prototype.three B.prototype.four | ||
]> | ||
ok compiled.indexOf(..) >= 0 "missing #{..}" |
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.
should be in test/compilation.ls
4d01965
to
a9f71c3
Compare
👍? |
The rationale looks a bit.. Slim to me. Do you have a bytesize comparison of the full compiler with and without this PR? |
The LS compiler's bytesize increases by 0.6%, from 224612 to 226009 (this is with regenerating Here is a quick survey of what some other class-supporting transpiled languages do:
If there were more code generators using the prototype var pattern, I'd say this is on Closure to become smarter. But given that the two giants in the room, CoffeeScript and TypeScript, do it the long but easily-optimized way, I think it makes sense for LiveScript to follow suit and enjoy the same optimizations that they do. |
I use zero classes in my projects. Classes are anathema to functional programming. |
Good news then, @naturalethic: this decision will have zero impact on your projects! |
... when assigning members to prototypes. As of this writing, Google's Closure Compiler can only perform some advanced analysis and optimizations if this form is used instead of the runtime-equivalent prototype var.
a9f71c3
to
ee43a71
Compare
Yup, no breaking change that I can think of. |
Okay. I think I'll just wait for @gkz's approval, then, I think. |
... when assigning members to prototypes. As of this writing, Google's
Closure Compiler can only perform some advanced analysis and
optimizations if this form is used instead of the runtime-equivalent
prototype var.
(See for yourself! Compare the optimizations that are applied to the output of current lsc with those applied to the output of the patch. The
unused
method gets removed in the latter.)