Thanks Lasse. Yes, I'm very aware that (a) others have written about this
and (b) JS isn't the only language where this is an issue. I thought that
(a) it would be useful to have a new perspective on the subject and (b)
JavaScript programmers are more likely to read about it if it's about
JavaScript!

I read about Call by sharing in the article Dmitry shared - I've added that
to the links at the bottom. I've also added the Wikipedia article as it's a
nice concise reference, thanks. Also interesting to see that it's only
Python users that really use that term (even though it's the only term that
properly describes the semantics).

You're right that I haven't explained what the terms mean properly - I was
trying more to give people a feeling for what's going on when you pass an
object to a function. Maybe one day I'll write another post about Call by
sharing :)

Thanks again,

Nick

On 27 December 2010 16:17, Lasse Reichstein <[email protected]>wrote:
>
>
> 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]<jsmentors%[email protected]>
>



-- 
Nick Morgan
http://skilldrick.co.uk
@skilldrick <http://twitter.com/skilldrick>

-- 
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]

Reply via email to