Originally Posted by Dormilich
out of principle. maybe except when you need to add core functionality where missing (like in IE).
reasons I would think of:
- improper for...in loops (I know that you won’t make that mistake)
- abuse (just because someone can do does not mean it is a good idea to)
- DOM will inherit it
so if it were done using Object.defineProperty() in a web worker thread, the only issue you'd have with it is "abuse"?
there have been a few times where a temporary Object.prototype method has drastically slashed code repetition. granted one of those was a VBscript emulator project with heaps of other inescapable globals, but the others were used in production code to instantiate a facade.
they provide right-now capabilities like classes and inheritance, composite types, continuations, generation, promises, and a lot more, and yet, we're told not to use most of them...
I've been wanting to use Object prototypes for years, i mean, it would be neat to have HTMLTableElement come with a .toCSV() or a .sortByColumn(n) method... or if form elements respected a magical data-persist attrib. or if <audio> had a .stop() method like every other media player API out there. With Object.defineProperty's non-enumerable capabilities, it could be our little secret.
since webworkers don't have a dom, do have their own global object, and suffer fewer inconsistencies in general, how about it; can i responsibly play with Object.prototytpe in workers?