Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13017

Re: call by reference

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> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
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 <jkhrtr$i06$1@news.albasani.net>
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^ITbFXUDVUnEXQm4IUK<Cl32<a4Fo<]lROoRa8kF<OcfhCOk:;[^=Pn_eYaDZm8W4\YJNlb@mF9jNikde@_VbHgL8kiae:>JCEmZX>b
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:13017

Followups directed to: comp.lang.javascript

Show key headers only | View raw


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<a.length;i++) a[i]=false; }
>   > 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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

call by reference Andreas Bergmaier <andber93@web.de> - 2012-03-23 13:56 +0100
  Re: call by reference Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-23 07:10 -0700
  Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-23 15:23 +0000
    Re: call by reference Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-23 09:28 -0700
      Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-23 19:41 +0000
        Re: call by reference Gene Wirchenko <genew@ocis.net> - 2012-03-23 13:43 -0700
          Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-23 21:18 +0000
            Re: call by reference BGB <cr88192@hotmail.com> - 2012-03-23 15:23 -0700
            Re: call by reference Gene Wirchenko <genew@ocis.net> - 2012-03-23 15:27 -0700
              Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-24 00:19 +0000
                Re: call by reference Norman Peelman <npeelmandog@cfl.rr.com> - 2012-03-28 06:43 -0400
                Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-28 14:50 +0000
                Re: call by reference Aatu Koskensilta <aatu.koskensilta@uta.fi> - 2012-03-28 18:06 +0300
                Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-28 15:57 +0000
                Re: call by reference Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-03-28 23:22 +0200
                Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-29 07:18 +0000
                Re: call by reference Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-03-29 13:34 +0200
                Re: call by reference David Mark <dmark.cinsoft@gmail.com> - 2012-03-29 18:30 -0700
                Re: call by reference Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-04-03 00:09 +0200
                Re: call by reference David Mark <dmark.cinsoft@gmail.com> - 2012-04-02 17:43 -0700
                Re: call by reference Robert Baer <robertbaer@localnet.com> - 2012-03-30 00:49 -0800
                Re: call by reference Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-28 13:33 -0700
              Re: call by reference John G Harris <john@nospam.demon.co.uk> - 2012-03-24 11:34 +0000
            Re: call by reference Aatu Koskensilta <aatu.koskensilta@uta.fi> - 2012-03-26 22:46 +0300
              Re: call by reference Gene Wirchenko <genew@ocis.net> - 2012-03-26 18:38 -0700
                Re: call by reference Aatu Koskensilta <aatu.koskensilta@uta.fi> - 2012-03-27 05:13 +0300
                Re: call by reference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-27 18:31 +0200
                Re: call by reference Aatu Koskensilta <aatu.koskensilta@uta.fi> - 2012-03-27 21:31 +0300
                Re: call by reference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-27 21:03 +0200
                Re: call by reference "Ross A. Finlayson" <ross.finlayson@gmail.com> - 2012-04-10 22:03 -0700
        Re: call by reference Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-25 07:34 -0700
          Re: call by reference "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-25 15:53 +0000
    Re: call by reference Asen Bozhilov <asen.bozhilov@gmail.com> - 2012-03-27 05:15 -0700
  Re: call by reference BGB <cr88192@hotmail.com> - 2012-03-23 13:03 -0700
  Re: call by reference Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-23 23:02 +0100
    Re: call by reference John G Harris <john@nospam.demon.co.uk> - 2012-03-24 11:40 +0000

csiph-web