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


Groups > comp.lang.javascript > #38299

Re: Object values (continued)

Newsgroups comp.lang.javascript
Subject Re: Object values (continued)
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <8f3v6ft5nntnuc7qi27q8if1crb40499hp@4ax.com> <2ebd204c-9149-455d-ac9c-1e6f1cd0db5e@googlegroups.com> <e58c7f1voimm7k775uctl2q8tostvrb5tt@4ax.com> <XnsAB87C8E8B32E5eejj99@194.109.6.166> <kcfe7f5r3t7dec74nn01b9up0s0npa0fr0@4ax.com>
Date 2020-03-22 23:30 +0100
Message-ID <XnsAB88EF22EF888eejj99@194.109.6.166> (permalink)

Show all headers | View raw


John G Harris <niam@jghnorth.org.uk.invalid> wrote on 22 Mar 2020 in 
comp.lang.javascript:

> On Sat, 21 Mar 2020 19:45:00 +0100, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
> 
>>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 21 Mar 2020 in 
>>comp.lang.javascript:
>>
>>> I haven't come across this use of 'by value' and 'by reference'
>>> before, nor can I find it in Wikipedia[English language]. You should
>>> add it.
>>
>>A primitive variable is referenced by value,
>>while an object is referenced by reference:
> 
> An interesting theory 

It is not a theory, it is a fact proven by the below code.

> so why isn't it in Wikipedia, preferably with citations ?

What a nonsensical argument, why is your great-grandmother not in Wikipedia?
 
> Now explain why a variable is big enough to hold a 1 Mbyte primitive
> string but not big enough to hold a 400 byte object.

Again, that has nothing to do with it.

>><script>
>>
>>let a = 0;
>>const b = {};
>>b.a = 7;
> 
> You're saying that .a can't be actioned if you assume that b's value
> is an object, not a pointer. How does the code below prove that?

No, I'm not saying that.

ALL let and const declared names are pointers, but pointers to primitive 
variables are handled different from pointers to objets.

*** Pointers to primitive variables are handled by VALUE.

*** Pointers to objects are handled by REFERENCE.

[However, in practice you can forget about the pointers, 
as their pointing values are internal and hidden to the programmer]


> It proves that if b's value is a pointer then automatic dereferencing
> will get the right result. It doesn't prove that no other way is
> possible.

I am not talking about "dereferencing", whatever that is.

> 
>>const f = (c, d) => {
>>     c = c + 100;
>>     d.a = d.a + 100;
>>};
>>
>>alert('a: ' + a); // 0
>>alert('b.a: ' + b.a); // 7
>>
>>f(a, b);
>>
>>alert('a: ' + a); // 0
>>alert('b.a: ' + b.a); // 107
>>
>></script>
> 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


Thread

Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-16 14:34 +0000
  Re: Object values  (continued) Jon Ribbens <jon+usenet@unequivocal.eu> - 2020-03-16 14:52 +0000
    Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-16 18:19 +0000
      Re: Object values  (continued) Jon Ribbens <jon+usenet@unequivocal.eu> - 2020-03-16 20:06 +0000
        Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-17 19:01 +0000
          Re: Object values  (continued) Jon Ribbens <jon+usenet@unequivocal.eu> - 2020-03-17 19:55 +0000
            Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-18 17:29 +0000
  Re: Object values  (continued) JJ <jj4public@vfemail.net> - 2020-03-17 12:48 +0700
    Re: Object values  (continued) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-03-17 17:51 +0100
      Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-17 19:03 +0000
        Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-18 07:20 +1100
          Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-18 17:29 +0000
            Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-19 14:21 +1100
              Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-19 11:12 +0000
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-20 14:33 +1100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-20 09:21 +0000
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-21 09:56 +1100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-21 11:18 +0000
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-22 08:45 +1100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-22 10:10 +0000
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-23 07:44 +1100
    Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-17 19:09 +0000
      Re: Object values (continued) Richard Damon <Richard@Damon-Family.org> - 2020-03-17 16:21 -0400
        Re: Object values (continued) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-03-17 22:57 +0100
  Re: Object values  (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-19 05:32 -0700
    Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-19 15:26 +0100
      Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-19 18:16 +0000
    Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-19 18:15 +0000
      Re: Object values  (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-19 11:54 -0700
        Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-20 09:11 +0000
          Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-27 15:35 +0000
            Re: Object values  (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-27 09:59 -0700
              Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-28 14:09 +0000
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-29 14:18 +1100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-29 10:40 +0100
                Re: Object values (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-29 04:41 -0700
    Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-21 14:12 +0000
      Re: Object values  (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-21 19:45 +0100
        Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-22 10:30 +0000
          Re: Object values  (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-22 23:30 +0100
            Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-23 09:44 +0000
              Re: Object values  (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-23 11:19 +0100
                Re: Object values  (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-23 05:00 -0700
                Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-23 18:05 +0000
                Re: Object values  (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-23 11:50 -0700
                Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-23 19:34 +0000
                Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-23 18:14 +0000
                Re: Object values  (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-23 22:21 +0100
                Re: Object values  (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-24 14:09 +0000
                Re: Object values  (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-25 00:01 +0100
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-24 01:18 +0100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-24 14:24 +0000
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-24 15:43 +0100
                Re: Object values (continued) Julio Di Egidio <julio@diegidio.name> - 2020-03-24 11:03 -0700
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-24 18:23 +0000
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-24 22:19 +0100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-25 16:34 +0000
                Re: Object values (continued) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-03-25 23:17 +0100
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-26 01:27 +0100
                Re: Object values (continued) Andrew Poulos <ap_prog@hotmail.com> - 2020-03-26 18:58 +1100
                Re: Object values (continued) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-03-26 10:43 +0000
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-26 12:22 +0100
                Re: Object values (continued) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-03-26 10:08 -0700
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-26 18:29 +0100
                Re: Object values (continued) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-03-26 14:17 -0700
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-26 23:37 +0100
                Re: Object values (continued) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-03-26 16:40 -0700
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-27 11:38 +0100
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-26 18:11 +0000
                Re: Object values (continued) Silvio <silvio@internet.com> - 2020-03-26 19:41 +0100
                Re: Object values (continued) "Mark-" <nospam@mapson.xyz> - 2020-03-25 00:00 +0000
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-25 15:05 +0000
                Re: Object values (continued) "Mark-" <nospam@mapson.xyz> - 2020-03-25 20:12 +0000
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-26 18:09 +0000
                Re: Object values (continued) John G Harris <niam@jghnorth.org.uk.invalid> - 2020-03-25 19:39 +0000
            Re: Object values  (continued) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-03-23 18:49 -0700

csiph-web