-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Remove prototype functions #1082
Comments
@pjcozzi So if I am understanding this correctly, to fix |
@cmorse correct, but more than the specs will need to change for many functions. |
Are you guys aware that this change would break chaining? For example, in the CatmullRomSpline constructor: this._ti = controlPoint1
.multiplyByScalar(2.0)
.subtract(controlPoint2)
.subtract(controlPoint0)
.multiplyByScalar(0.5); would become something like: this._ti = Cartesian3.multiplyByScalar(
Cartesian3.subtract(
Cartesian3.subtract(
Cartesian3.multiplyByScalar(controlPoint1, 2.0),
controlPoint2),
controlPoint0),
0.5); I don't know anything about the web worker stuff, but if they lose the prototypes, it probably would be better to go this route in the end. |
In our own code, I'm pretty sure we don't really want chaining (even if some places currently have it). However, that is a good point in terms of user code convenience. Assuming we are going ahead with the change, I would break these out into multiple lines. |
Sounds good. How would you break them out into multiple lines? With a temporary variable, or like I did above? |
I just realized that there are places in the code that we rely on the ability to clone an object without knowing what that object is, for instance, ConstantProperty. In order to remove prototype clone that means that everywhere which creates a ConstantProperty or TimeIntervalProperty must pass in the type of object (like we do with Things like this are why I'm hesitant to pull any fixes for this issue into master until the entire conversion is complete. There are too many issues that could crop up and dong it piecemeal might create additional problems if larger areas of the code need to be reworked. |
@mramato That's why I didn't remove the clone prototype function in my pull request. I saw what |
Awesome, I missed that. Thanks. We'll figure out in the future if we should keep it or not. |
In order to cleanly implement some things in DynamicScene, I need to put back prototype |
OK with me. |
We've made excellent progress here. Thanks @cmorse! Before closing this, here's the other types I think we should address:
These will be much easier than the types we already changed. |
|
Alright. Removed |
Added above
|
As discussed on the forum.
Let's start with the Cartesian, Quaternion, and Matrix types in Core. Then, we are likely to move beyond them to types like BoundingSphere and BoundingRectangle.
The text was updated successfully, but these errors were encountered: