PS: Also in ES6 modules it will be not possible to extend module Math. --- A. Matías Quezada Senior Javascript Developer [email protected]
2014-07-03 15:02 GMT+02:00 A Matías Quezada <[email protected]>: > Extending host objects? I don't think that favors readability and > maintainability. > > If I don't know TAU (or some one read my code and doesn't know it) and see > this I will look for Math.TAU on MDN, not on the project and if by chance I > guess it's defined somewhere in the project how will I know? there is no > reference to the file where the variable is created. > > Sounds like create a global variable, we know the consequences this has > for readability and maintainability. > > --- > A. Matías Quezada > Senior Javascript Developer > [email protected] > > > > 2014-07-03 9:47 GMT+02:00 Thaddee Tyl <[email protected]>: > > On Wed, Jul 2, 2014 at 5:52 PM, A Matías Quezada <[email protected]> >> wrote: >> > 1. Use Math.PI * 2 everywhere >> > 2. Create a TAU constant on every file >> > 3. Create a TAU constant on a single file and require this file from >> > everywhere just for this >> >> 4. Do Math.TAU = Math.PI * 2 once somewhere. It even works in node.js, >> inside of the same process, leaking through require()s. >> >> And some do it: >> <https://github.com/search?q=%22Math.TAU%22&type=Code&ref=searchresults> >> > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

