From: Jorge on 1 Nov 2009 06:28 On Nov 1, 12:14 pm, Jorge <jo...(a)jorgechamorro.com> wrote: > (...) placed at the right hand side of an assignment. (...) s/right/left/ -- Jorge.
From: Lasse Reichstein Nielsen on 1 Nov 2009 07:16 Jorge <jorge(a)jorgechamorro.com> writes: > On Oct 31, 6:49�pm, Lasse Reichstein Nielsen <lrn.unr...(a)gmail.com> > wrote: >> (...) >> The pedantic detail here is that "passed by reference" isn't a well >> defined term with lots of history, but "call-by-reference" is. >> Depending on the interpretation, javascript might or might not have >> the former. It definitly doesn't have the latter: You can't pass an >> L-value. >> (...) > > It seems to me that calling it like that is an extended C and Pascal - > elder- programmers' habit. L-value or call-by-reference? Personally, I take the words from my Computer Science education (and therefore it is probably a reflection of my eachers and authors of the books we used), and not from a single language. > In C we hadn't the Pascal syntax for "var > parameters", but we could always achieve the same effect by passing > the appropriate &thing. At the receiving end it was just a matter of > dereferencing -explicitly, unlike in Pascal- the thing* as much -or as > little- as needed. It walks like a duck and quacks like a duck, > therefore, we may have inherited Pascal's terminology, which was > either "passed by value" (for value parameters) or "passed by > reference" (for var parameters). I'm talking about the (late) 70's and > the 80's. I would be wary at calling pointer passing "pass-by-reference", even though it can give the same effect. After all, it's all Turing complete, so "the same effect" can be gotten in any case. On the other hand, that makes it very much a matter of taste where to put the line between "real" call-by-reference and explicit passing of references/pointers by value. > I don't think that *call* by reference (the term) was ever > used (then), we said either to "pass by reference" or said nothing > (implying "by value"). It was, and in the negative too :) I just found this page, which is particularly enlightening: <URL:http://effbot.org/zone/call-by-object.htm> Short summary: Barbara Liskov about CLU said that it was neither call-by-value nor call-by-reference, and then invented the name "call-by-sharing" (and some also used "call-by-objects"). > The term Lvalue (and Rvalue) was used (rather > rarely if at all) to mean that a thing/expression (result) could be > placed at the right hand side of an assignment. It was not used -not > at all- in explaining parameter passing. Yes, I used it as a shorthand for passing something that allows variables of the caller to be affected, because merely saying that you pass "a variable" seems to confuze a lot of people. What Liskov is quoted as saying above was actually: "it is not call by reference because access is not given to the variables of the caller," JavaScript passes primitive values by value and objects by sharing. Personally, I'll probably just keep saying "call-by-value with reference types" to myself and "call-by-sharing, go check wikipeida" here. :) /L -- Lasse Reichstein Holst Nielsen 'Javascript frameworks is a disruptive technology'
From: optimistx on 2 Nov 2009 05:09 Johannes Baagoe wrote: > I haven't so far found an accurate explanation of the argument > passings mechanism in javascript, and since it is a very basic > question, > I wonder what I have missed. This far this thread has 55 entries, 14 participants, and there does not seem to be unanimousity about this basic thing. Is this the feature of the language, the participiants, or is there only a serious fault in my understanding of written text? I promised to try to draw a picture of this topic, but whatever I would imagine to draw, I expect a bunch of people opposing fiercely. How would one present this simply to a person, who has used numerous other languages but is fairly new to javascript? A link perhaps?
From: Richard Cornford on 2 Nov 2009 07:53 On Nov 2, 10:09 am, optimistx wrote: > Johannes Baagoe wrote: >> I haven't so far found an accurate explanation of the argument >> passings mechanism in javascript, and since it is a very basic >> question, I wonder what I have missed. > > This far this thread has 55 entries, 14 participants, and there > does not seem to be unanimousity about this basic thing. The disagreements are about which terminology is applicable, the behaviour of javascript/ECMAScript is understood and has been stated. > Is this the feature of the language, No, in most regards there is objectively defined terminology (from the spec) available for use in the discussion of javascript, which is sufficient for most practical purposes. > the participiants, or is there > only a serious fault in my understanding of written text? You don't appear to have understood what it is that is being argued about. > I promised to try to draw a picture of this topic, but whatever > I would imagine to draw, I expect a bunch of people opposing > fiercely. Why would anyone oppose your drawing a picture? Whether that picture accurately/usefully depicted what goes is another matter, but that could not be judged prior to seeing it. Many people have created diagrammatic representations of structures from javascript, but the vast majority of them that I have seen have been technically dubious. And when you asked to the direct towards such diagrams the overwhelming silence that resulted suggested that nobody else has seen any that they consider to be worth looking at. However, it is worth mentioning the accessibility aspects of diagrammatic representations of javascript. It is likely that anyone who has studied the subject in any real depth has also been exposed to questions of accessibility in relation to web documents (and it is human nature to be broadly in favour of accessibility as a general principle). Diagrams are inherently problematic for the blind, and possibly some with restricted/defective eyesight. This is an issue that is addressed by providing a text based alternative. But if the text based alternative is viable, and is going to be created in addition to the diagram, then the worth of making the effort to create the diagram becomes questionable. > How would one present this simply to a person, who has used > numerous other languages but is fairly new to javascript? > A link perhaps? That is probably going to depend a lot on which other languages those are. If Java, for example, appears in that set they suggesting that what happens in javascript is pretty much line what happens in Java (in terms of what can be done with arguments, and the consequences) would probably get the job done. Richard.
From: Lasse Reichstein Nielsen on 2 Nov 2009 11:42
"optimistx" <optimistx(a)hotmail.com> writes: > This far this thread has 55 entries, 14 participants, and there does > not seem to be unanimousity about this basic thing. I think almost everybody agrees on what happens. The problem is what to call it. > Is this the feature of the language, the participiants, or is there > only a serious fault in my understanding of written text? It seems to be a problem for all languages with the same behavior. Similar discussions appear in Java and Python newsgroups too. > I promised to try to draw a picture of this topic, but whatever > I would imagine to draw, I expect a bunch of people opposing > fiercely. Pretty certainly. It's the stuff that holy wars are fought over. > How would one present this simply to a person, who has used numerous > other languages but is fairly new to javascript? A link perhaps? "It's just like Python" should suffice. :) /L -- Lasse Reichstein Holst Nielsen 'Javascript frameworks is a disruptive technology' |