|
From: Thomas 'PointedEars' Lahn on 6 May 2008 15:46 Matthias Watermann wrote: > On Tue, 06 May 2008 03:09:03 -0700, VK wrote: >> [...] >>> var o1 = new childOne(), o2 = new childTwo(); >>> >>> Now when calling "o1.aMethod()" the "DUNNO" should be "o1" and the >>> same with "o2" respectively. >> and with >> var o1 = new childOne(); >> // ... >> var foo = o1; >> foo.aMethod(); >> >> what DUNNO should be, "o1" or "foo"? > > Theoretically "foo". But in practice I don't care as I do not use such > a construct. (No offence meant.) You miss the point. Objects just don't have names, they have identity. Properties have names. Object references can be values of properties, and there can be any number of different properties referencing the same object. To keep track of all of them would require you to implement a record object that is used every time a property of an object is added, modified or deleted. And that is not only impossible as there are built-in objects and host-defined properties, but the result retrieved then would be far from being usable for debugging. PointedEars -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
|
Pages: 1 Prev: why do both lines of code work?! Next: eBay-style drop down menu |