Path: csiph.com!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <5091390.GdagIssoVF@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Fri, 23 Mar 2012 23:02:14 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: call by reference Newsgroups: comp.lang.javascript References: Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 37 NNTP-Posting-Date: 23 Mar 2012 23:02:15 CET NNTP-Posting-Host: f7f8f875.newsspool4.arcor-online.net X-Trace: DXC=aW7LR?g^ITbFXUDVUnEXQm4IUKJCEmZX>b X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:13017 Andreas Bergmaier wrote: > I know, JavaScript does not support call-by-reference. Every function > invocation does call-by-value, even if that value is a reference value > to an array-/function-/plain-Object, and not a primitive. Correct. > Yet, there is a javascript thing There is no "javascript". > that stores values by reference: the arguments object. No. According to ECMAScript Edition 5(.1) [ES5], section 10.6, the Arguments object has special internal [[Get]] and [[Set]] methods to allow the observed behavior. > > function kill(a) { for (var i=0;i > function x(a,b,c) { kill(arguments); return[a,b,c] }; > > x(true,true,true) > [false, false, false] > > I did not assign to a, b or c. Can this be termed "call-with-references" > or something? Yes (it can be termed something). The behavior you observed has been removed for strict code in [ES5]. PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee