- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Thu, 5 May 2011 20:15:12 -0700
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: Allen Wirfs-Brock <allen@wirfs-brock.com>, Cameron McCormack <cam@mcc.id.au>, public-script-coord@w3.org
On 5/5/11, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 5/5/11 7:17 PM, Allen Wirfs-Brock wrote:
>> But native JS objects can also dynamically mutate in apparently arbitrary
>> ways:
>
> Yes, but "apparently" is the key part here.
>
>> var myGlobal = { };
>> alert(myGlobal.toString); //built-in toString function
>> callSomeFunctionIdontKnowMuchAbout();
>> alert(myGlobal.toString); //displays some other value because a toString
>> property was added to the myGlobal obj by the function
>> callAnotherFunctionIdontKnowMuchAbout();
>> alert(myGlobal.toString); //built-in toString function because the
>> function deleted the property the new toString property from the obj
>
> Yes, but for this to happen the functions you call have to know
> something about myGlobal.
No, you don't.
Function `callSomeFunctionIdontKnowMuchAbout` could have created a
global property `myGlobal` or could do a for-in loop on the global
object itself.
Have to go to airport. Interesting discussion!
--
Garrett
Received on Friday, 6 May 2011 03:15:39 UTC