On Mon, Dec 7, 2009 at 2:50 PM, Mark S. Miller <erig...@google.com> wrote: > On Mon, Dec 7, 2009 at 11:40 AM, Maciej Stachowiak <m...@apple.com> wrote: >> >> On Dec 4, 2009, at 1:48 PM, Garrett Smith wrote: >> >>> Static Array and String Generics was an ES4 proposal[0], and is >>> implemented in Mozilla JavaScript 1.6[1]. > > > Note that the function generics on that page[0] break Liskov > substitutability,
Yes, the LSP issue with Function.apply was discussed.. The subject is about static Array and String generics, not Function Generics. Array generics alone would provide more benefit, so for sake of simplifying the argument, it might be best to narrow the focus to discussion of static Array generics. > >>> What are the plans for including Array and String Generics in future >>> revision of ES? >> >> I'm curious about this as well. We've had some requests to add these to >> JavaScriptCore. I'd like to know if they were explicitly rejected from >> standard ECMAScript, or might be considered for further ECMAScript editions. > > They were explicitly rejected for ES5, but more by way of postponing > the issue rather than rejecting them for the future. They may indeed > be considered for ES-Future. > > Fixing Function.prototype.toString wording was also postponed. As has been discussed, that method is still broken by design in ES5. Probably a number of desirable things were left unfinished (the TG39 committee should know about these more than I do). >> Would the ECMAScript standards community advise that we implement these in >> WebKit or hold off? > > I would recommend holding off. IMO, their extra convenience does not > pay for the added complexity. > I am failing to understand the complexity argument. Can you clarify? AISI, Array.prototype.slice.call(x, start, end) ia arguably more complex with Array.slice(x, start, end); The generic version, if implemented correctly, would be more efficient. The cumulative effect of Array generics should be slightly faster, slightly cleaner code, in many places: http://www.google.com/codesearch?q=Array.prototype.slice+lang%3Ajavascript&hl=en&btnG=Search+Code There is a reason I mentioned the IE error in the thread about static Array generics. Array generics (non static) would probably see a lot more use, were it not for MSIE and "JScript object expected". Suppose IE changes so that array generics "work" with host object. There would be a trend towards using Array.prototype.slice.call( x, s, e) as old error-throwing IE becomes obsolete. In that case, static* Array generics would get more widespread use and so the static Array.slice would be wanted in more places. Garrett _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss