On Jun 9, 2008, at 6:25 PM, Pratap Lakshman (VJ#SDK) wrote: > I'll fix my usage of 'function' in the steps. > > Presently, top-level generics are not there in ES3.1. I had brought > this up when discussing String generics (refer the thread "ES3.1 > Draft: String generics"); I am using the same rationale for not > including top level Array generics too.
Hi Pratap, I missed this rationale extension and wanted to point out that there's a difference between String generics and Array generics that is substantial: the String.prototype.slice, etc., methods all call ToString on the value of "this", requiring conversion to string from non-String object (ES3 sense) types. But the Array generics do not convert. So it's possible and useful to call: Array.prototype.slice.call(nodeList, begin, end) for example. That's the motivation for the static-generic shorter forms, e.g.: Array.slice(nodeList, begin, end) /be > > Use the following link to subscribe to the ES3.x discuss list: > https://mail.mozilla.org/listinfo/es3.x-discuss > > pratap > > > -----Original Message----- > From: Garrett Smith [mailto:[EMAIL PROTECTED] > Sent: Sunday, June 08, 2008 9:20 PM > To: Pratap Lakshman (VJ#SDK) > Cc: [email protected] > Subject: Re: ES3.1 Draft: Array generics > > On Sun, Jun 8, 2008 at 2:50 PM, Pratap Lakshman (VJ#SDK) > <[EMAIL PROTECTED]> wrote: >> Garrett, >> I apologize. >> I was not ignoring you. Yes, I am interested in feedback! > > OK, but you seem to have misunderstood me. > >> >> The initial Array generics proposal did not include the thisObj >> param as it was felt that it could open the door to some security >> issues. We were even contemplating cutting Array generics from >> ES3.1 altogether. Later, based on feedback from many of us on the >> discuss lists, we are going back to specifying the Array Generics >> to include the "thisObj" param; these generics will be available >> on Array.prototype. I am currently revising the proposal, and it >> will include the following: >> Array.prototype.indexOf >> Array.prototype.lastIndexOf >> Array.prototype.every >> Array.prototype.some >> Array.prototype.forEach >> Array.prototype.map >> Array.prototype.filter >> >> and also, >> Array.prototype.reduce >> Array.prototype.reduceRight >> > > I meant the top-level generics: > > Array.forEach(arrayLike, fn); > > It was not my argument for: > > Array.prototype.forEach(fn[, thisArg]); > > The thisArg was what Erik had brought up. > > The other question was regarding the: > "If Type(callbackfn) is not a function, throw a TypeError exception." > > ES 3.0 doesn't define "Function" as a Type. In fact, the spec often > uses: If "x is a Function". There is: "if Type(x) is Number", but not > "if Type(x) is Function". That is why I asked if ES 3.1 defines > Function for Type(). Does it? > ES 3.1: Type, section 8 > http://bclary.com/2004/11/07/#a-8 > > If ES 3.0 had forEach, it would probably have read something along the > lines of one of: > 1) If callbackfn does not implement [[Call]], throw a TypeError. > 2) If callbackfn is not a function, throw a TypeError. > >> I am not sure how you got unsubscribed; there must be some mistake! >> > > I don't know either. Is there a link to get back on? > > Garrett > >> pratap >> > [snip] > _______________________________________________ > Es4-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es4-discuss _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
