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


Groups > comp.lang.javascript > #34811 > unrolled thread

Trying to create array of object literals

Started bybit-naughty@hotmail.com
First post2018-04-12 12:17 -0700
Last post2018-04-13 04:08 -0700
Articles 20 on this page of 81 — 12 participants

Back to article view | Back to comp.lang.javascript


Contents

  Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-12 12:17 -0700
    Re: Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-12 12:26 -0700
    Re: Trying to create array of object literals Maik Koenig <usenetspam@maikkoenig.de> - 2018-04-12 21:47 +0200
    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-12 12:49 -0700
    Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-13 10:27 +0200
      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-13 10:57 +0100
        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-13 23:38 +0200
          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-14 11:22 +0100
            Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-14 07:25 -0700
              Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-14 09:09 -0700
                Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 09:43 +0100
                  Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:04 -0700
                  Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 11:23 +0200
                    Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:32 +0100
                      Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-17 23:37 +0200
                        Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 16:18 +0100
                          Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-19 23:08 +0200
                            Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-20 10:17 +0100
                              Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-20 12:45 +0200
                                Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-20 19:08 +0100
                Re: Trying to create array of object literals "c.l.js" <trollhunter@curiosity.kills.no> - 2018-04-20 17:04 -0300
                  Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-20 13:15 -0700
                  Is JS a functional programming language? (was: Trying to create array of object literals) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-21 02:35 +0200
                    Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-21 01:36 -0700
                      Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-21 11:46 -0700
                        Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-21 11:48 -0700
                        Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-21 23:53 -0700
                          Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-22 10:33 -0700
                            Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-23 00:27 -0700
                              Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-23 11:50 -0700
                                Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-23 12:00 -0700
                                  Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-23 15:07 -0700
                                    Re: Is JS a functional programming language? "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-04-24 00:47 +0200
                                      Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-23 16:12 -0700
                                        Re: Is JS a functional programming language? "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-04-24 01:30 +0200
                                      Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-23 16:45 -0700
                                      Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-24 09:54 +0100
                                        Re: Is JS a functional programming language? Tim Streater <timstreater@greenbee.net> - 2018-04-24 10:17 +0000
                                      Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-24 12:02 -0700
                                        Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-25 05:04 +0200
                                          Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-25 02:16 -0700
                                            Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-25 02:20 -0700
                                            Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-25 18:22 +0100
                                              Re: Is JS a functional programming language? Jon Ribbens <jon+usenet@unequivocal.eu> - 2018-04-25 17:25 +0000
                                              Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-25 14:50 -0700
                                          Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-25 14:39 -0700
                                            Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-29 20:44 +0200
                                              Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-29 13:45 -0700
                    Re: Is JS a functional programming language? "c.l.js" <trollhunter@curiosity.kills.no> - 2018-04-21 19:51 -0300
                      Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 01:18 +0200
                        Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 02:19 +0200
                          Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 01:52 +0000
                            Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 04:30 +0200
                              Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 02:45 +0000
                                Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 05:55 +0200
                                  Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 04:04 +0000
                                    Re: Is JS a functional programming language? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-22 10:59 +0200
                                      Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-22 11:03 +0100
                                        Re: Is JS a functional programming language? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-22 12:50 +0200
                                          Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-23 09:19 +0100
                                      Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 12:58 +0000
              Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 10:02 +0100
                Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:05 -0700
                  Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 11:27 +0200
                    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:33 -0700
                      Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 14:03 +0200
                      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:40 +0100
                        Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 09:45 +0100
                        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-18 03:25 +0200
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 15:50 +0100
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 16:08 +0100
                            Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-19 03:34 +0200
                              Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-19 10:37 +0100
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-19 19:02 +0100
                        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-19 03:25 +0200
                  Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:37 +0100
                    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 11:48 -0700
                      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 09:52 +0100
                        Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-17 03:22 -0700
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 18:28 +0100
      Re: Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-13 04:08 -0700

Page 1 of 5  [1] 2 3 4 5  Next page →


#34811 — Trying to create array of object literals

Frombit-naughty@hotmail.com
Date2018-04-12 12:17 -0700
SubjectTrying to create array of object literals
Message-ID<2ea2803e-c39d-40e0-b8ed-136c3dc9b4e0@googlegroups.com>
I have this in my code:

var point = {
	x:0,
	y:0
};


Now I want to build an array of the "point" array literal (ie. storing 3 points):

var projectedpoly = point[3];

So that I can do this:

document.write(projectedpoly[i].x);



But the "var projectedpoly = point[3]; " statement is not working, far as I can see - what must I do?

[toc] | [next] | [standalone]


#34812

Frombit-naughty@hotmail.com
Date2018-04-12 12:26 -0700
Message-ID<67e20c44-8587-4a84-aee1-643a21026b28@googlegroups.com>
In reply to#34811
On Friday, April 13, 2018 at 12:47:26 AM UTC+5:30, bit-n...@hotmail.com wrote:
> I have this in my code:
> 
> var point = {
> 	x:0,
> 	y:0
> };
> 
> 
> Now I want to build an array of the "point" array literal (ie. storing 3 points):
> 
> var projectedpoly = point[3];
> 
> So that I can do this:
> 
> document.write(projectedpoly[i].x);
> 
> 
> 
> But the "var projectedpoly = point[3]; " statement is not working, far as I can see - what must I do?



Oops I forgot to say: the document.write thing will actually be in a loop, like this:

for (var i=0; i<3; i++) {
document.write(projectedpoly[i].x);
}

[toc] | [prev] | [next] | [standalone]


#34814

FromMaik Koenig <usenetspam@maikkoenig.de>
Date2018-04-12 21:47 +0200
Message-ID<paok66.8d4.1@mid.maikkoenig.de>
In reply to#34811
Am 12.04.2018 um 21:17 schrieb bit-naughty@hotmail.com:
> I have this in my code:
> 
> var point = { x:0, y:0 };
> 
> 
> Now I want to build an array of the "point" array literal (ie.
> storing 3 points):
> 
> var projectedpoly = point[3];
> 
> So that I can do this:
> 
> document.write(projectedpoly[i].x);
> 
> But the "var projectedpoly = point[3]; " statement is not working,
> far as I can see - what must I do?

var point = [{
  x:0,
  y:0
},
{
  x:1,
  y:1
},
{
  x:2,
  y:2
},
{
  x:3,
  y:3
}];
console.log (point[2].x);     // 2



Greetz,
MK
-- 
Kopp-Verlag-Gläubige, Religionsdeppen, rechte Vollidioten
 und ähnlicher Bio-Abfall werden ohne Hinweis ignoriert!
            - Sei eine Möwe: Scheiss drauf -

[toc] | [prev] | [next] | [standalone]


#34815

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-12 12:49 -0700
Message-ID<4ed05c47-1a59-430e-a11b-aa4eb553aa67@googlegroups.com>
In reply to#34811
On Thursday, 12 April 2018 21:17:26 UTC+2, bit-n...@hotmail.com  wrote:
> I have this in my code:
> 
> var point = {
>   x:0,
>   y:0
> };
> 
> 
> Now I want to build an array of the "point" array literal (ie. storing 3
> points):

A way to define it "in place" is like this:

var points = [
  { x:0, y:0 },
  { x:1, y:1 },
  { x:2, y:2 }
];

> var projectedpoly = point[3];

The name is usually plural.  Anyway, to the point, that just does not exist
in JS: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array>

Julio

[toc] | [prev] | [next] | [standalone]


#34817

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2018-04-13 10:27 +0200
Message-ID<3364120.8dbtfUO1ph@PointedEars.de>
In reply to#34811
Stefan Ram wrote:

> bit-naughty@hotmail.com writes:
>>var point = {
>>x:0,
>>y:0
>>};
>>Now I want to build an array of the "point" array literal (ie. storing 3
>>points):
> 
>   A literal is solely an entity of the source code model,
>   literals are not run-time values.

Also, it is _not_ an Array literal, but an _Object_ literal/initialiser, 
equivalent to:

  var point = new Object();
  point.x = 0;
  point.y = 0;

IOW, in both cases “point” holds a reference to an Object instance; “x” and 
“y” are the names of the *properties* of that object, and the zeroes are the 
*property values*.

JavaScript/ECMAScript *basics* (and told to the anonymous, address-munging¹ 
OP several times before²).

________
¹  <http://www.interhack.net/pubs/munging-harmful/>
   <https://tools.ietf.org/html/rfc5536#section-3.1.2>

²  <http://www.catb.org/esr/faqs/smart-questions.html>
 
>>var projectedpoly = point[3];
> 
>   You might want:
> 
> { const p = []; for( let i = 0; i < 3; ++i )p.push({ x: 0, y: 0 }); }

Readable:

  {
    const polygon = [];
    for (let i = 0; i < 3; ++i)
    {
      polygon.push({x: 0, y: 0});
    }
  }

Probably closer to what was *really* being looked for:

  var point1 = {x: 1, y: 2};
  var point2 = {x: 3, y: 4};
  var point3 = {x: 5, y: 6};
  var polygon = [point1, point2, point3];

or (functionally equivalent)

  var polygon = [
    {x: 1, y: 2},
    {x: 3, y: 4},
    {x: 5, y: 6}
  ];

or (functionally equivalent)

  function Point (x, y)
  {
    this.x = x;
    this.y = y;
  }

  var point1 = new Point(1, 2);
  var point2 = new Point(3, 4);
  var point3 = new Point(5, 6);
  var polygon = [point1, point2, point3];

or (functionally equivalent)

  function Point (x, y)
  {
    this.x = x;
    this.y = y;
  }

  var polygon = [
    new Point(1, 2),
    new Point(3, 4),
    new Point(5, 6)
  ];

then

  /* an Object instance equivalent to {x: 5, y: 6} */
  var point = polygon[2];

Definining a point as an instance of a custom object type (“Point” is its 
constructor) has the advantages that all point objects automatically have 
the same structure, can have the same methods (this allows polymorphism), 
and details of the implementation are hidden from the user of the object 
(information hiding).  [The properties are still publicly accessible 
directly here, but that can be fixed.]

In that sense, “polygon” should be a reference to an instance of a custom 
object type as well (there are operations that apply to all polygons).

<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide>


In order to DRY,

  var polygon = [
    {x: 1, y: 2},
    {x: 3, y: 4},
    {x: 5, y: 6}
  ];

can be converted thus:

  function Point (x, y)
  {
    /* When called as a function, work as factory (type conversion) */
    if (!(this instanceof Point)) return new Point(x, y);

    if (x instanceof Object)
    {
      /*
       * Assume a reference to an object to be converted;
       * this also allows Point({x: 42, y: 23}) instead of
       * Point(42, 23), getting rid of the opaqueness of
       * arguments, and the dependency on argument order.
       */
      this.x = x.x;
      this.y = x.y;
    }
    else
    {
      this.x = x;
      this.y = y;
    }
  }

  polygon = polygon.map(Point);

This approach is very useful when dealing with JSON, e.g.:

  var data = `[
    {"x": 1, "y": 2},
    {"x": 3, "y": 4},
    {"x": 5, "y": 6}
  ]`;

  var points = JSON.parse(data).map(Point);

“points” now refers to an Array instance of references to Point instances 
that are initialized with the values in the JSON (and could itself be passed 
as an argument to, e.g., a Polygon constructor/factory).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#34818

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-13 10:57 +0100
Message-ID<4mv0ddt3bre9bbiofnvabnbamlp9jfj072@4ax.com>
In reply to#34817
On Fri, 13 Apr 2018 10:27:44 +0200, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:


  <snip>
>IOW, in both cases “point” holds a reference to an Object instance;
                                    ^^^^^^^^^
  <snip>

Why describe values in a complicated way when there is a simpler 
way, a way that is compatible with the ECMAScript Standard?

Say that each variable and property contains a pointer to its 
current Value-structure. Other variables and properties can 
point to the same Value-structure. Now it's easier to see why 
the following fragment of code behaves the way it does :
  a;         // Where a.c exists, and a.c == 5
  b = a;     // Now also b.c == 5
  b.c = 42;  // Now a.c == 42 also!
// a and b share the same Value-structure (an object, here)

Also, with this description a megabyte primitive string can be an 
argument in a function call efficiently. There is no need for the 
argument value to be a copy of the long string. And no need for 
this to be a special case in the implementation.

  John

[toc] | [prev] | [next] | [standalone]


#34821

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2018-04-13 23:38 +0200
Message-ID<15901681.8V3EAehsKz@PointedEars.de>
In reply to#34818
John G Harris wrote:

> On Fri, 13 Apr 2018 10:27:44 +0200, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:

Again: Attribution _line_, not attribution novel.

>> IOW, in both cases “point” holds a reference to an Object instance;
>                                     ^^^^^^^^^
> 
> Why describe values in a complicated way when there is a simpler
> way, a way that is compatible with the ECMAScript Standard?
> 
> Say that each variable and property contains a pointer to its
> current Value-structure. […]

That "simpler" way is _not_ compatible with whatever you think "the 
ECMAScript Standard" is.  *No* Edition of the ECMAScript Language 
Specification (so far) specifies such *implementation* details.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#34822

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-14 11:22 +0100
Message-ID<idl3ddhclidkc7rtn9hs90utlvb3t7a3em@4ax.com>
In reply to#34821
On Fri, 13 Apr 2018 23:38:49 +0200, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

>John G Harris wrote:
>
>> On Fri, 13 Apr 2018 10:27:44 +0200, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>
>Again: Attribution _line_, not attribution novel.
>
>>> IOW, in both cases ?point? holds a reference to an Object instance;
>>                                     ^^^^^^^^^
>> 
>> Why describe values in a complicated way when there is a simpler
>> way, a way that is compatible with the ECMAScript Standard?
>> 
>> Say that each variable and property contains a pointer to its
>> current Value-structure. […]

On writing
  > something [Remark]
a sensible person would notice that it is ambiguous. Was Remark
written by the person quoted, or by the person doing the quoting?
A sensible person would then use a scheme that does not have this 
serious design flaw, such as
  > something
    [Your remark here]
  > something else


>That "simpler" way is _not_ compatible with whatever you think "the 
>ECMAScript Standard" is.  *No* Edition of the ECMAScript Language 
>Specification (so far) specifies such *implementation* details.

What an amazingly silly remark. *Obviously*, 'pointer' is an
implementation detail. Equally obviously, so is 'reference'. The
difference is that 'reference' gives a thouroughly misleading
description of the ECMAScript language's semantics.

  John

[toc] | [prev] | [next] | [standalone]


#34823

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-14 07:25 -0700
Message-ID<3dd0b784-9634-4047-b79b-a171d1e1d099@googlegroups.com>
In reply to#34822
On Saturday, 14 April 2018 12:22:37 UTC+2, John G Harris  wrote:
> On Fri, 13 Apr 2018 23:38:49 +0200, Thomas 'PointedEars' Lahn
> <PointedEars@web.de> wrote:
<snip>
> >That "simpler" way is _not_ compatible with whatever you think "the 
> >ECMAScript Standard" is.  *No* Edition of the ECMAScript Language 
> >Specification (so far) specifies such *implementation* details.
> 
> What an amazingly silly remark. *Obviously*, 'pointer' is an
> implementation detail. Equally obviously, so is 'reference'. The
> difference is that 'reference' gives a thouroughly misleading
> description of the ECMAScript language's semantics.

There are no pointers in JS, not even near.  And a reference is not a pointer,
and no, a reference is not an implementation detail.  You have it upside down.

Julio

[toc] | [prev] | [next] | [standalone]


#34825

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-14 09:09 -0700
Message-ID<611cba1f-e8f1-4ca1-8eb5-5e10456200d1@googlegroups.com>
In reply to#34823
On Saturday, 14 April 2018 16:25:21 UTC+2, Julio Di Egidio  wrote:
> On Saturday, 14 April 2018 12:22:37 UTC+2, John G Harris  wrote:
> > On Fri, 13 Apr 2018 23:38:49 +0200, Thomas 'PointedEars' Lahn
> > <PointedEars@web.de> wrote:
> <snip>
> > >That "simpler" way is _not_ compatible with whatever you think "the 
> > >ECMAScript Standard" is.  *No* Edition of the ECMAScript Language 
> > >Specification (so far) specifies such *implementation* details.
> > 
> > What an amazingly silly remark. *Obviously*, 'pointer' is an
> > implementation detail. Equally obviously, so is 'reference'. The
> > difference is that 'reference' gives a thouroughly misleading
> > description of the ECMAScript language's semantics.
> 
> There are no pointers in JS, not even near.

JS is a *functional* language: the modularity is modularity of *lexical*
constructs and contexts...  (Someone else might be able to say it better.)

> And a reference is not a pointer,
> and no, a reference is not an implementation detail.
> You have it upside down.

Julio

[toc] | [prev] | [next] | [standalone]


#34835

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-16 09:43 +0100
Message-ID<deo8dddb83pql63kvh19e7m8bh7chspi4f@4ax.com>
In reply to#34825
On Sat, 14 Apr 2018 09:09:36 -0700 (PDT), Julio Di Egidio
<julio@diegidio.name> wrote:


  <snip>
>JS is a *functional* language: the modularity is modularity of *lexical*
>constructs and contexts...  (Someone else might be able to say it better.)
  <snip>

What has this to do with the question of whether or not the value of a
variable can be an object?

  John

[toc] | [prev] | [next] | [standalone]


#34837

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-16 02:04 -0700
Message-ID<92d681ef-f03a-46bb-938e-3d11edbd4dda@googlegroups.com>
In reply to#34835
On Monday, 16 April 2018 10:43:44 UTC+2, John G Harris  wrote:
> On Sat, 14 Apr 2018 09:09:36 -0700 (PDT), Julio Di Egidio
> <julio@diegidio.name> wrote:
>   <snip>
> >JS is a *functional* language: the modularity is modularity of *lexical*
> >constructs and contexts...  (Someone else might be able to say it better.)
>   <snip>
> 
> What has this to do with the question of whether or not the value of a
> variable can be an object?

What has that to do with my "There are no pointers"?  Snip, deny and repeat?

Julio

[toc] | [prev] | [next] | [standalone]


#34840

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-04-16 11:23 +0200
Message-ID<XnsA8C673D5DACFEeejj99@194.109.6.166>
In reply to#34835
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 16 Apr 2018 in 
comp.lang.javascript:

> On Sat, 14 Apr 2018 09:09:36 -0700 (PDT), Julio Di Egidio
> <julio@diegidio.name> wrote:
> 
> 
>   <snip>
>>JS is a *functional* language: the modularity is modularity of *lexical*
>>constructs and contexts...  (Someone else might be able to say it better.)
>   <snip>
> 
> What has this to do with the question of whether or not the value of a
> variable can be an object?

That would stretch the meaning of 'value'.

JS variables and constants can 
1 have numeric or string 'values'.
2 be a 'pointer' to an object.

More than one variable can point to the same object,
so we cannot externally identify such object by a specific name.
so perhaps say that the "pointer value" is hidden to the programmer.

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

[toc] | [prev] | [next] | [standalone]


#34846

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-16 19:32 +0100
Message-ID<6uq9ddd88tnvmntvefiehf7l6rg5n95c2o@4ax.com>
In reply to#34840
On Mon, 16 Apr 2018 11:23:13 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 16 Apr 2018 in 
>comp.lang.javascript:
>
>> On Sat, 14 Apr 2018 09:09:36 -0700 (PDT), Julio Di Egidio
>> <julio@diegidio.name> wrote:
>> 
>> 
>>   <snip>
>>>JS is a *functional* language: the modularity is modularity of *lexical*
>>>constructs and contexts...  (Someone else might be able to say it better.)
>>   <snip>
>> 
>> What has this to do with the question of whether or not the value of a
>> variable can be an object?
>
>That would stretch the meaning of 'value'.
>
>JS variables and constants can 
>1 have numeric or string 'values'.
>2 be a 'pointer' to an object.

Now explain why ECMA 262, the ECMAScript standard, says

"An ECMAScript language type corresponds to values that are directly
manipulated by an ECMAScript programmer using the ECMAScript
language."

  and

"The ECMAScript language types are Undefined, Null, Boolean, String,
Symbol, Number, and Object."

  and

"An ECMAScript language value is a value that is characterized by an
ECMAScript language type."

Tell me why you think "characterized by" means "sometimes a pointer
to".


>More than one variable can point to the same object,
>so we cannot externally identify such object by a specific name.
>so perhaps say that the "pointer value" is hidden to the programmer.

And I have demonstrated that there is another implementation that does
the same without needing the value field/structure to be a pointer.

  John

[toc] | [prev] | [next] | [standalone]


#34861

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-04-17 23:37 +0200
Message-ID<XnsA8C7F05FE4AE9eejj99@194.109.6.166>
In reply to#34846
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 16 Apr 2018 in
comp.lang.javascript: 

> On Mon, 16 Apr 2018 11:23:13 +0200, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
> 
>>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 16 Apr 2018 in 
>>comp.lang.javascript:
>>
>>> On Sat, 14 Apr 2018 09:09:36 -0700 (PDT), Julio Di Egidio
>>> <julio@diegidio.name> wrote:
>>> 
>>> 
>>>   <snip>
>>>>JS is a *functional* language: the modularity is modularity of
>>>>*lexical* constructs and contexts...  (Someone else might be able to
>>>>say it better.) 
>>>   <snip>
>>> 
>>> What has this to do with the question of whether or not the value of a
>>> variable can be an object?
>>
>>That would stretch the meaning of 'value'.
>>
>>JS variables and constants can 
>>1 have numeric or string 'values'.
>>2 be a 'pointer' to an object.
> 
> Now explain why ECMA 262, the ECMAScript standard, says

Will you stop ordering others what to do.

I am a JS user, not the writer of a standard, so ask them.

> "An ECMAScript language type corresponds to values that are directly
> manipulated by an ECMAScript programmer using the ECMAScript
> language."
> 
>   and
> 
> "The ECMAScript language types are Undefined, Null, Boolean, String,
> Symbol, Number, and Object."
> 
>   and
> 
> "An ECMAScript language value is a value that is characterized by an
> ECMAScript language type."
> 
> Tell me why you think "characterized by" means "sometimes a pointer
> to".

Will you stop ordering others what to do.

If you disagree with an argument, give a better one.

>>More than one variable can point to the same object,
>>so we cannot externally identify such object by a specific name.
>>so perhaps say that the "pointer value" is hidden to the programmer.
> 
> And I have demonstrated that there is another implementation that does
> the same without needing the value field/structure to be a pointer.

C++?

I don't hold "the value field/structure to be a pointer",
I don't even think in "value field/structures",
but in the JS meaning of contant and variable names.


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

[toc] | [prev] | [next] | [standalone]


#34868

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-18 16:18 +0100
Message-ID<4doedd1hn0995osluvarg6iq9740k7tb5a@4ax.com>
In reply to#34861
On Tue, 17 Apr 2018 23:37:47 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

  <snip>
>Will you stop ordering others what to do.
  <snip>

Does that mean that a polite request would get a proper reply?


>I don't hold "the value field/structure to be a pointer",
>I don't even think in "value field/structures",
>but in the JS meaning of contant and variable names.

Ah, you are talking denotational semantics, as in :

  x denotes an object
  y denotes a long string 
  z denotes false

Or do you prefer :

  x denotes a pointer to an object
  y denotes a pointer to a long string 
  z denotes false


  John

[toc] | [prev] | [next] | [standalone]


#34875

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-04-19 23:08 +0200
Message-ID<XnsA8C9EB749A597eejj99@194.109.6.166>
In reply to#34868
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 18 Apr 2018 in 
comp.lang.javascript:

> On Tue, 17 Apr 2018 23:37:47 +0200, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
> 
>   <snip>
>>Will you stop ordering others what to do.
>   <snip>
> 
> Does that mean that a polite request would get a proper reply?

No, it does not, the end of impoliteness does not buy cooperation.



>>I don't hold "the value field/structure to be a pointer",
>>I don't even think in "value field/structures",
>>but in the JS meaning of contant and variable names.
> 
> Ah, you are talking denotational semantics, as in :
> 
>   x denotes an object
>   y denotes a long string 
>   z denotes false

Not at all, I describe JS implementation.

> Or do you prefer :
> 
>   x denotes a pointer to an object
>   y denotes a pointer to a long string 
>   z denotes false

See, again you are narrowing another down to choose from your views,
only a slightly better form of ordering.

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

[toc] | [prev] | [next] | [standalone]


#34876

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-20 10:17 +0100
Message-ID<oubjdd10n692bibtviiplj05m9knlhko3j@4ax.com>
In reply to#34875
On Thu, 19 Apr 2018 23:08:46 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 18 Apr 2018 in 
>comp.lang.javascript:
>
>> On Tue, 17 Apr 2018 23:37:47 +0200, "Evertjan."
>> <exxjxw.hannivoort@inter.nl.net> wrote:
  <snip>
>>>I don't hold "the value field/structure to be a pointer",
>>>I don't even think in "value field/structures",
>>>but in the JS meaning of contant and variable names.
>> 
>> Ah, you are talking denotational semantics, as in :

In case it wasn't clear : the "meaning of contant and variable names"
is what denotational semantics defines.


>>   x denotes an object
>>   y denotes a long string 
>>   z denotes false
>
>Not at all, I describe JS implementation.

There is more than one possible implementation. Are you describing
your preferred implementation? Or were you not aware of alternatives?
Or do you prefer to be a dictator?


>> Or do you prefer :
>> 
>>   x denotes a pointer to an object
>>   y denotes a pointer to a long string 
>>   z denotes false
>
>See, again you are narrowing another down to choose from your views,
>only a slightly better form of ordering.

You've said earlier that x means pointer to object. Are you saying you
don't approve of these meanings of y and z? 

  John

[toc] | [prev] | [next] | [standalone]


#34877

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-04-20 12:45 +0200
Message-ID<XnsA8CA81C35F071eejj99@194.109.6.166>
In reply to#34876
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 20 Apr 2018 in 
comp.lang.javascript:

> On Thu, 19 Apr 2018 23:08:46 +0200, "Evertjan."
> <exxjxw.hannivoort@inter.nl.net> wrote:
> 
>>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 18 Apr 2018 in 
>>comp.lang.javascript:
>>
>>> On Tue, 17 Apr 2018 23:37:47 +0200, "Evertjan."
>>> <exxjxw.hannivoort@inter.nl.net> wrote:
>   <snip>
>>>>I don't hold "the value field/structure to be a pointer",
>>>>I don't even think in "value field/structures",
>>>>but in the JS meaning of contant and variable names.
>>> 
>>> Ah, you are talking denotational semantics, as in :
> 
> In case it wasn't clear : the "meaning of contant and variable names"
> is what denotational semantics defines.
> 
> 
>>>   x denotes an object
>>>   y denotes a long string 
>>>   z denotes false
>>
>>Not at all, I describe JS implementation.
> 
> There is more than one possible implementation.

That's why I wrote "JS implementation"
not "THE JS implementation".

> Are you describing
> your preferred implementation?

No. 

> Or were you not aware of alternatives?

See, again you are in the limiting mode.

> Or do you prefer to be a dictator?

You are acting silly. 

This is a discussion, try to take arguments on their value.

>>> Or do you prefer :
>>> 
>>>   x denotes a pointer to an object
>>>   y denotes a pointer to a long string 
>>>   z denotes false
>>
>>See, again you are narrowing another down to choose from your views,
>>only a slightly better form of ordering.
> 
> You've said earlier that x means pointer to object.

I did not use x.

> Are you saying you
> don't approve of these meanings of y and z? 

Why would you think that? 

I did not use y and z.

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

[toc] | [prev] | [next] | [standalone]


#34878

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-20 19:08 +0100
Message-ID<34bkdd9u0btpp134se3hlj4p3tvf32urie@4ax.com>
In reply to#34877
On Fri, 20 Apr 2018 12:45:22 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 20 Apr 2018 in 
>comp.lang.javascript:
>
>> On Thu, 19 Apr 2018 23:08:46 +0200, "Evertjan."
>> <exxjxw.hannivoort@inter.nl.net> wrote:
>> 
>>>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 18 Apr 2018 in 
>>>comp.lang.javascript:
>>>
>>>> On Tue, 17 Apr 2018 23:37:47 +0200, "Evertjan."
>>>> <exxjxw.hannivoort@inter.nl.net> wrote:

  <snip>
>>>>>I don't even think in "value field/structures",
>>>>>but in the JS meaning of contant and variable names.
  <snip>

>This is a discussion, try to take arguments on their value.
  <snip>

But you said you don't think about value!

  John

(And yes, I am writing in the style of Evertjan)

[toc] | [prev] | [next] | [standalone]


Page 1 of 5  [1] 2 3 4 5  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web