-
Notifications
You must be signed in to change notification settings - Fork 56
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
Clone methods do not respect proper OOP #50
Comments
Thank you @kungfooman . Do you think you could make a PR for just a single one of those classes, so I see how it looks in practice? |
I would invest more time since this is an interesting project, but I realized I can"t do anything with this based on the license. Last time I checked ThreeJS got it wrong aswell, but PlayCanvas does it right, so you can take that as an example: Or a non-trivial case: I don"t know how it fits your project, PlayCanvas is MIT license but also paid (for extra online editor abilities like project exporting). MIT license is usually attracting more contributors. |
Thanks a lot for those links. There are indeed cases where I"m using this method to clone objects, like the following: (although those classes are never inherited):
When it"s with classes that do get inherited, using And regarding the license, Polygonjs used to be MIT, but I"ve recently switched to Polyform Shield, mostly to forbid the creation of a competing node-based editor and marketplace. But it is restriction free otherwise. I"m still pondering if that"s the right choice, as I definitely want to encourage contributions. I"ll keep educating myself on that subject. Maybe having a contributor agreement like playcanvas could help. Thanks a ton for your feedback either way. I"ll leave this issue open until I have a more definitive answer on this. |
Thank you for checking, this is a TypeScript issue that is open since 2015 with 201 thumbs-up: microsoft/TypeScript#3841 It is so important to write proper OOP but they simply don"t care or don"t know how to fix it. I would be happy if it finally works, but it may take another few years. 😅 Maybe it helps to simply raise awareness, the more people ask for it the better.
That sounds good, when I read the Pricing page it said 0$ = Non Commercial only and all kinds of other restrictions. Maybe thats just the online editor, that is closed source anyway? Just from my personal experience it scares me and then I won"t even try it. Have fun brainstorming the licensing strategy, I"m glad my feedback was welcomed! |
Thank you for finding this typescript issue, very good to know. I"ll see if some forced casting along with specific tests can improve this. Regarding the license, yes, the free plan being limited to non-commercial only applies to the visual editor (which is indeed closed source). For the core library here, it"s free to use, as long as it"s not to compete with the editor and (soon to be released) marketplace. That should probably be clearer, so I"ll have a think on how to improve that messaging. |
The license has been updated to plain MIT. |
What you have right now all over the place is:
However, you can show very easily how wrong it is if you actually try to use OOP:
specialNode1 instanceof SpecialNode
is of course true, butspecialNode2
regresses into aNode
... the proper way to clone in JavaScript is:new this.constructor(this.asd)
The text was updated successfully, but these errors were encountered: