[OpenLayers-Trac] [OpenLayers] #962: Check for existing prototypes on objects and don't clobber them
OpenLayers
trac at openlayers.org
Tue Sep 11 14:53:15 EDT 2007
#962: Check for existing prototypes on objects and don't clobber them
------------------------+---------------------------------------------------
Reporter: crschmidt | Owner: euzuro
Type: task | Status: assigned
Priority: major | Milestone: 2.6 Release
Component: general | Version: 2.4
Resolution: | Keywords:
------------------------+---------------------------------------------------
Comment (by tschaub):
In case I wasn't descriptive enough in my comment above, I really think we
should take an alternative tack. Instead of adding sugar to the language,
lets act like a library.
Unfortunately, nobody else writes small libraries that we can import, so
we're stuck reimplementing extra stuff we want. As long as we are relying
on functionality that the language doesn't give us, it belongs in our
library - and in our namespace. We don't want to make decisions based on
any other names (like String.prototype.trim or Function.prototype.bind) -
we only know about names that start with OpenLayers - because we clobbered
whatever else someone else may have defined there.
So, really, please consider moving away from these sugary sweet language
extensions. And I don't believe it all has to wait until 3.0. I'd rather
see OpenLayers.Function.bind in 2.6 instead of if(Function.prototype.bind)
{OpenLayers.Console.error("yikes, I wanted to do that")}.
--
Ticket URL: <http://trac.openlayers.org/ticket/962#comment:8>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list