Is this D or is it Javascript?

Kagamin spam at here.lot
Tue Jul 9 12:14:29 PDT 2013


On Saturday, 6 July 2013 at 00:21:54 UTC, Adam D. Ruppe wrote:
> // the second () is just because @property is broken
> writeln(Math.max()("12", 24)); // prints 24

With dynamic typing there's no way to tell if Math.max(12,24) is 
a method call or field delegate call. Javascript assumes it's 
member call and passes this pointer to the called function. When 
I implemented an object for javascript, I chose to detect if a 
called method is a field with delegate and forward the call to 
the delegate as per semantics of javascript.


More information about the Digitalmars-d-announce mailing list