Re: ES4 draft: Function
Why doesn't Function have something like apply that does the same as in a new expression, i.e. allocate-init-and-apply? To put it another way: given arguments in an array, I want to write: F.thisThing(args) and have it mean the same as new F(args[0], args[1], ... args[n-1]) Or is what happens behind the veil of object creation detailed enough that I can write a facsimile of it with apply? I guess something like: var x = {}; x.prototype = F.prototype; x = F.apply(x, args) || x; But why force me to guess? No doubt I am wrong. Dominic On Mon, Mar 10, 2008 at 7:38 PM, Jon Zeppieri [EMAIL PROTECTED] wrote: On 3/10/08, Lars Hansen [EMAIL PROTECTED] wrote: First draft of the spec for the Function class. Please comment. Suggestion: deprecate the Function constructor and static invoke(). Almost all of its uses are better handled by function expressions and, in those cases where eval() in required, one can use eval(). -Jon ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Re: ES4 draft: Function
Neat! Thanks for the link. Dominic On Thu, Mar 13, 2008 at 10:58 AM, Jon Zeppieri [EMAIL PROTECTED] wrote: On Thu, Mar 13, 2008 at 1:48 PM, Dominic Cooney [EMAIL PROTECTED] wrote: Why doesn't Function have something like apply that does the same as in a new expression, i.e. allocate-init-and-apply? To put it another way: given arguments in an array, I want to write: F.thisThing(args) and have it mean the same as new F(args[0], args[1], ... args[n-1]) How about the proposed spread/spat(...) operator : new F(...args) http://bugs.ecmascript.org/ticket/357 -Jon ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
Greedy triple-quoted string literals
There's a note on the triple-quoted string literals proposal*: we decided that triple-quoted strings would be greedy when looking for the closing triple-quotes. Wouldn't this mean, in practice, that it is only possible to have two triple-quoted string literals per source file (one with and another with ''')? * http://wiki.ecmascript.org/doku.php?id=proposals:triple_quotes ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
'\u' c.f. ECMA 262 section 7.8.4
There's a comment on the triple-quoted string proposal that hints at \u meaning u; and a couple of implementations I tried (Rhino and Safari) implement this. But reading ECMA 262 section 7.8.4 it looks like that is invalid, since u is an EscapeCharacter but not a SingleEscapeCharacter. This is trivia, but perhaps ES4 should explicitly allow \u. Dominic ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss
catch-if syntax?
I notice that the normative grammar* doesn't mention SeaMonkey's catch (identifier if expr) syntax for filtering exceptions. Is that deliberate? Dominic * http://www.ecmascript.org/es4/spec/grammar.pdf ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss