Hello,

Just thought I would try to start a discussion around this ticket (not
the exact solution, more just the comments on it):

http://dev.rubyonrails.org/ticket/6650

as, looking back through the list, theres been no discussion here so
far (although theres been a fair bit in the comments on the ticket).
I think it's really important to do something about this because as it
stands Prototype overwrites JS 1.6 methods with incompatible
versions.  As more browser support these methods and more scripts
depend on them its going to be a problem.

The main problem is that Array.map and Array.filter take 3 arguments
in JS 1.6 (the third one being the scope that the function will run
in) but these get overwritten with the Prototype versions which aside
from being a fair bit slower don't work in the same way.

Firstly, I think its pretty essential that Enumerable is adjusted to
take the scope argument (which can default to window for backwards
compatibility).  It's also, as mentioned in the ticket, really quite
useful and a lot nicer looking than function() { ... }.bind(this)
which is now the common Prototype idiom (although admittedly there's
not a lot in it).

Secondly, I really think that in areas like this where optimisation is
going to make a big difference to most people's script speeds it's
really worth considering how generally worthwhile having the break
continue stuff in is compared to allowing browsers to use native
versions if need be.  Andrew suggests having different versions of
methods that support this if you need them which I think is a good
idea as in most cases we don't need  break (and as mislav says, return
does continue).  Dean Edwards also mentioned that the try...catches
also cause some problems with debugging although I'll need to ask him
for the details.  I'm not sure how to implement this stuff in a
backward compatible way but from my point of view it does need
addressing at some point.

So what does everyone think? (if you've all already come to a
conclusion on this I apologise...please point me to the discussion I
missed)

Cheers,

Dan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to