Re : [Enhancement] Construction pattern


I should have insisted more on code duplication maybe. The more locs the more bugs. Sometimes this pattern is repeated in the constructor, some fromXXX, clone, … That’s a lot of duplicated code to change should you update the constructor.

My idea was to put the logic in the proto version and have other versions use it.

I’d skip on the new prototype functions - it’s just yet another way to do something. It’s more code to write, document, and test. The Matrix and Cartesian types have prototype and non-prototype versions of many functions, and experience is starting to show that the prototype versions are rarely used.


carto = new Cartographic();


For users, this is less concise and less efficient since it will initialize the object’s parameters twice. Add that up in a tight loop, and performance-caution users will just bypass it and write custom code.

We put a lot of thought into object construction (Matt is that discussion in github pull requests? I can’t find it on the forum), and I think things are pretty consistent and efficient here, at least in these low-level types.