On Mon, 27 Dec 2010 13:13:31 +0100, Nick Morgan <[email protected]>
wrote:
Hi guys
I've written a new blog post about something that's been bothering me
for a
while - the distinction between pass-by-reference and pass-by-value.
http://skilldrick.co.uk/2010/12/clearing-up-the-confusion-around-javascript-references/
<http://skilldrick.co.uk/2010/12/clearing-up-the-confusion-around-javascript-references/>I'd
like to know if anything either doesn't make sense or is just plain
wrong.
You are not the first to write about this[1], and JavaScript isn't the
first
language to have this way of passing objects (and either of you will
probably
be the last :).
The original name for this parameter passing strategy seems to be
http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing
It's neither call-by-value nor call-by-reference.
I can live with both this or "call-by-value of reference values" (objects
being neither
expressible nor denotable, but object references are both).
There can be no doubt that there is no call-by-reference in JavaScript.
Call-by-reference
is the passing of an L-value, and that never happens in JavaScript (or
Java, or Python).
As for comments, the section "So what does pass-by-reference mean?"
doesn't actually
describe what pass-by-reference means. It seems to suggest that passing a
reference value
is somehow related to pass-by-reference, but I'm not sure what the point
is exactly.
Same for the "pass-by-value" section. Asking people to forget all they
know, and then
not putting something instead, doesn't really work :)
/L
[1] E.g.
http://javadude.com/articles/passbyvalue.htm
http://stackoverflow.com/questions/2027/pass-by-reference-or-pass-by-value
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]