W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

[Bug 15986] Specify exactly how and when ECMAScript arguments are evaluated

From: <bugzilla@jessica.w3.org>
Date: Tue, 14 Feb 2012 23:55:49 +0000
To: public-script-coord@w3.org
Message-Id: <E1RxSDt-0001kv-7U@jessica.w3.org>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15986

--- Comment #7 from Cameron McCormack <cam@mcc.id.au> 2012-02-14 23:55:48 UTC ---
Yes, argument values are consistently evaluated/converted left to right. 
Regarding invoking the overload resolution algorithm even when there is only a
single operation, consider the following.  Assume we didn't call the overload
resolution algorithm with a single operation, and start with:

  void f(long x, Node n);

Call f({ valueOf: function() { throw "hi" }}, window).  This will result in
"hi" being thrown, since we just do the argument conversion from left to right
without checking the values that were passed in before doing the conversions.

If we add an overload:

  void f(long x, Node n);
  void f();

then calling f({ valueOf: function() { throw "hi" }}, window) will now throw a
TypeError due to there being no appropriate overload (window didn't match
Node).

I think it is preferable to avoid this kind of behaviour change for existing
calls when introducing a new overload.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Tuesday, 14 February 2012 23:55:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC