On Tue, Aug 18, 2009 at 4:23 PM, Louis Santillan <[email protected]> wrote:
> > Magic methods? I've used rhino for years and I have never seen > anything about "magic methods". Are you speaking of the JavaAdapter > techniques? Sorry for the confusion. My "magic methods" i'm refering to methods which are particular to a given JS engine and have special meaning for a given engine. e.g. from: http://github.com/jeresig/env-js/blob/70ed3800d7abaaff54af67e39842f4fc3e5fac61/src/env.js very close to the top we see: window.__defineSetter__("location", function(url){ ... }); window.__defineGetter__("location", function(url){ ... }); (IIRC the PHP documentation calls this type of thing "magic methods", and that's probably where i derived the term from.) In this example, __defineSetter__ is apparently a magic method which defines what happens when you do: window.location = ...; and __defineGetter__ defines what happens when we do: var x = window.location; ECMA does not, AFAIK, define such constructs, but something similar is commonly found in JS engines to give binders a bit more freedom. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
