From: VK on 21 Oct 2009 19:33 > but on putting it in writing just some nonsense is coming out... By that I meant myself as well as in the linked discussion.
From: Richard Cornford on 21 Oct 2009 18:46 John G Harris wrote: > Thomas 'PointedEars' Lahn wrote: <snip> >> It is actually very simple to understand if you accept the specified >> truth that object references are values (of the internal Reference >> type). > <snip> > > Unfortunately, ECMA 262 defines members of the Reference type to be > something different from what most people would call a reference. > > A Reference selects a particular property of a particular object. > > A reference is something that behaves like a pointer to an object. > (There's more than one way they could be implemented). The relevance of the internal Reference type to argument passing is questionable anyway as the evaluation of Argument Lists (Section 11.2.4) has the internal GetValue (8.7.1) function called on all the AssignmentExpressions in the list, and while the argument to the GetValue method may or may not be a Reference type the result of that function call cannot ever be one. Richard.
From: Johannes Baagoe on 21 Oct 2009 20:15 Thomas 'PointedEars' Lahn : > Someone competent should use the Wiki functionality of MDC and correct > it ASAP. I see you did it. Much better than the previous version, thank you. -- Johannes
From: Johannes Baagoe on 21 Oct 2009 20:31 Martin Honnen : > With Javascript it is all pass by value where values can be primitive > values like number, boolean, string or can be object references. Yes, I think I got it, thanks. The implications were not clear to me yesterday, but I hope they are now. > I think Java is similar. I dare say you are right, from the explanations I have gathered. Actually, it seems that that particular argument passing mechanism was invented by Barbara Liskov who called it "call by sharing", if Wikipedia is to be believed : http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing Very clever and elegant, anyway, in my opinion, and not at all difficult to understand, but it still should be explained clearly somewhere. I suggest in the FAQ. -- Johannes
From: VK on 21 Oct 2009 21:05
Richard Cornford wrote: > The relevance of the internal Reference type to argument passing is > questionable anyway as the evaluation of Argument Lists (Section 11.2.4) > has the internal GetValue (8.7.1) function called on all the > AssignmentExpressions in the list, and while the argument to the > GetValue method may or may not be a Reference type the result of that > function call cannot ever be one. The function argument creation process is rather straightforward yet might be far from an obvious one: on call the function gets the name of the entry from the name table but doesn't use it and it creates two new name table entries instead: the one classid-like generated for the anonymous (language-level wise) arguments[i] entry where i corresponds to the ltr argument index, the other named one for the argument entry if such "sugar naming" is being used so: function f() { // code } f(foo); - only one new name table entry for arguments[0] function f(arg) { // code } f(foo); - two new name table entries for arguments[0] and for arg Closure lovers (== "encapsulation is the must that rulez") oftenly forget about it so letting their closures'-heavy code to leak over the anonymous counterparts. |