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: Wed, 15 Feb 2012 15:53:17 +0000
To: public-script-coord@w3.org
Message-Id: <E1RxhAT-0007EB-4b@jessica.w3.org>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15986

--- Comment #11 from Aryeh Gregor <ayg@aryeh.name> 2012-02-15 15:53:16 UTC ---
That only requires a very special case of overloading -- where one variant's
arguments are a prefix of the other's.  If that's all we need, then replace the
overload resolution algorithm with just throwing an exception if the number of
arguments is wrong.  No type-checking would be needed at all.  So HTML's
drawImage would become

  void drawImage(
    (HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image,
    double dx, double dy);
  void drawImage(
    (HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image,
    double dx, double dy, double dw, double dh);
  void drawImage(
    (HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image,
    double sx, double sy, double sw, double sh,
    double dx, double dy, double dw, double dh);

(Although this seems like not a great API anyway -- too many arguments that can
mean different things depending on how you call it.  It doesn't seem like the
end of the world if we require extra prose to support this case.)

-- 
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 Wednesday, 15 February 2012 15:53:22 UTC

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