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


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

Objects what are they.

Started byjonas.thornvall@gmail.com
First post2019-04-25 02:16 -0700
Last post2019-04-26 23:07 +0200
Articles 20 on this page of 83 — 9 participants

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


Contents

  Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:16 -0700
    Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:40 -0700
    Re: Objects what are they. groovee@cyberdude.com - 2019-04-25 09:12 -0700
      Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:37 +0100
        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:41 -0700
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:56 -0700
            Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:00 -0700
          Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 10:45 +0100
            Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 04:37 -0700
              Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:41 +0100
                Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 21:11 +0200
                  Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 13:23 -0700
                    Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 23:32 +0200
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:11 -0700
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:24 -0700
                        Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-27 11:52 +0200
                    Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:17 +0100
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:00 -0700
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:06 -0700
                  Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:08 +0100
            Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-28 05:03 -0700
              Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 18:11 +0200
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 03:43 -0700
                  Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 14:11 +0200
                    Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 11:15 -0400
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:41 -0700
                        Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 15:16 -0400
                          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 15:56 -0700
                            Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:08 -0700
                              Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:30 -0700
                      Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:44 -0700
                    Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:31 -0700
          Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 13:48 +0200
        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:25 -0700
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:30 -0700
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 01:06 -0700
        Re: Objects what are they. groovee@cyberdude.com - 2019-04-26 07:41 -0700
          Re: Objects what are they. Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-04-26 15:39 +0000
            Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:23 +0200
              Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:25 +0100
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:10 -0700
                  Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:17 -0700
                    Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:39 +0100
                      Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:16 -0700
                        Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-28 10:53 +0100
                          Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 07:08 -0700
                            Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 11:03 +0100
                  Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:43 +0100
          Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:36 +0100
            Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:53 -0700
              Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 10:35 +0100
          Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 17:45 +0200
            Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:19 -0700
              Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 20:57 +0200
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 06:53 -0700
                  Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 15:08 +0100
                    Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:21 +0200
                      Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 20:06 +0100
                        Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 23:09 +0200
                          Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 10:39 +0100
                            Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 14:06 +0200
                              Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 05:26 -0700
                                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 19:14 +0200
                                  Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 12:07 -0700
                                    Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 14:29 +0100
                                      Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-05-01 07:52 -0700
                                        Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 18:34 +0100
                                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:27 +0100
                              Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:22 +0100
                                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 22:25 +0200
                                  Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 15:15 +0100
                  Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 18:31 +0200
                    Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:42 -0700
                      Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:42 +0200
                    Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 17:35 -0700
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 00:18 -0700
                        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:00 -0700
                          Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 06:16 -0700
                            Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:38 -0700
                      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:21 -0700
            Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:43 -0700
              Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 19:02 +0200
      Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:07 +0200

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


#36410 — Objects what are they.

Fromjonas.thornvall@gmail.com
Date2019-04-25 02:16 -0700
SubjectObjects what are they.
Message-ID<8e03edae-dc71-4a28-9b80-579934821794@googlegroups.com>
Objects are data logical structures and placeholders reachable by name, in programming languages they have a type.

The attributes of an object are called its properties.

When objects have properties that can further be divided it is a nested object.

The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...

Now we take the object synth.

Obj. Synth: 
     Prop. Synth[](Bankindex,Bankname,Instruments) 
     SubProp. Instrument[](Instrumentindex,Instrumentname,Notes)
     SubProp. Note[](Notename)

New Array Synths[]:synth;
     
//Access

Synth[i].Banksindex=0;
Synth[i].BanksName="Ambient";
Synth[i].Instrument[j].Instrumentname="Trombone";
Synth[i].Instrument[j].Note[k].Notename="Hihat";

Now to create a new synthobject with all properites null we simply.

synth.length++; or why not new.synth;

Now can someone tell me how to do these 10 lines of ***pseudo code*** using the clinically insane syntax of javascript?

If there is some logical inconsistence or its lacking necessary functionality and features in my pseudocode compared with javascript objects please inform.



[toc] | [next] | [standalone]


#36411

Fromjonas.thornvall@gmail.com
Date2019-04-25 02:40 -0700
Message-ID<832a60cd-f2c2-4096-ac14-0759a8284e10@googlegroups.com>
In reply to#36410
Den torsdag 25 april 2019 kl. 11:16:25 UTC+2 skrev jonas.t...@gmail.com:
> Objects are data logical structures and placeholders reachable by name, in programming languages they have a type.
> 
> The attributes of an object are called its properties.
> 
> When objects have properties that can further be divided it is a nested object.
> 
> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...
> 
> Now we take the object synth.
> 
> Obj. Synth: 
>      Prop. Synth[](Bankindex,Bankname,Instruments) 
>      SubProp. Instrument[](Instrumentindex,Instrumentname,Notes)
>      SubProp. Note[](Notename)
> 
> New Array Synths[]:synth;
>      
> //Access
> 
> Synth[i].Banksindex=0;
> Synth[i].BanksName="Ambient";
> Synth[i].Instrument[j].Instrumentname="Trombone";
> Synth[i].Instrument[j].Note[k].Notename="Hihat";
> 
> Now to create a new synthobject with all properites null we simply.
> 
> synth.length++; or why not new.synth;
> 
> Now can someone tell me how to do these 10 lines of ***pseudo code*** using the clinically insane syntax of javascript?
> 
> If there is some logical inconsistence or its lacking necessary functionality and features in my pseudocode compared with javascript objects please inform.

Maybe one could had extra parenthese to denote that it is a subproperty *subobject*, not reachable at level. Of course the props whatever subobjects whatever type not just arrays. But in this case they were. 

Obj. Synth: 
     Prop. Synth[](Bankindex,Bankname,(Instrument)) 
     SubProp. Instrument[](Instrumentindex,Instrumentname,(Note)) 
     SubProp. Note[](Notename) 

New Array Synths[]:synth; 

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


#36416

Fromgroovee@cyberdude.com
Date2019-04-25 09:12 -0700
Message-ID<1e0e684f-a0c8-40d9-b43d-9129a7d4b99d@googlegroups.com>
In reply to#36410
On Thursday, 25 April 2019 14:46:25 UTC+5:30, jonas.t...@gmail.com  wrote:

> 
> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...


I didn't read all of your post, but - I have often felt the exact same! :) WTF is "document.getElementById("blah").addEventListener" ANYWAY? You have to do THAT MUCH to register a simple event handler?

....and I TILL DATE (and I've been battling with JS for a while now) don't understand what TWO DOTS (as above) mean - to me, it's incomprehensible :(

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


#36420

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2019-04-25 18:37 +0100
Message-ID<c0s3cep7c7lug1b76jko8g008c9t779crk@4ax.com>
In reply to#36416
On Thu, 25 Apr 2019 09:12:15 -0700 (PDT), groovee@cyberdude.com wrote:

>On Thursday, 25 April 2019 14:46:25 UTC+5:30, jonas.t...@gmail.com  wrote:
>
>> 
>> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...
>
>
>I didn't read all of your post, but - I have often felt the exact same! :) WTF is "document.getElementById("blah").addEventListener" ANYWAY? You have to do THAT MUCH to register a simple event handler?

How then would you say which part of the document that event handler
should be associated with?


>....and I TILL DATE (and I've been battling with JS for a while now) don't understand what TWO DOTS (as above) mean - to me, it's incomprehensible :(

You want to do something to the b part of a. One notation to get to it
is a<b>; another is  b of a ; a more popular one is a.b .

Obviously, if b has a c part you get to it by doing a.b.c . Or would
you prefer c of b of a ?

  John

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


#36423

Fromjonas.thornvall@gmail.com
Date2019-04-25 23:41 -0700
Message-ID<aee65943-9a1b-4201-b3ec-ca6a4422580c@googlegroups.com>
In reply to#36420
Den torsdag 25 april 2019 kl. 19:37:51 UTC+2 skrev John G Harris:
> On Thu, 25 Apr 2019 09:12:15 -0700 (PDT), groovee@cyberdude.com wrote:
> 
> >On Thursday, 25 April 2019 14:46:25 UTC+5:30, jonas.t...@gmail.com  wrote:
> >
> >> 
> >> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...
> >
> >
> >I didn't read all of your post, but - I have often felt the exact same! :) WTF is "document.getElementById("blah").addEventListener" ANYWAY? You have to do THAT MUCH to register a simple event handler?
> 
> How then would you say which part of the document that event handler
> should be associated with?
> 
> 
> >....and I TILL DATE (and I've been battling with JS for a while now) don't understand what TWO DOTS (as above) mean - to me, it's incomprehensible :(
> 
> You want to do something to the b part of a. One notation to get to it
> is a<b>; another is  b of a ; a more popular one is a.b .
> 
> Obviously, if b has a c part you get to it by doing a.b.c . Or would
> you prefer c of b of a ?
> 
>   John

Hello John, i just need to know, ***how do i declare this nested object***, either i am  fucking stupid because i can't find any similar examples, and i really tried to figure it out by myself ***trial and error*** mostly error LoL

Synth[i].Bank[j].Instrument[k].Note[l].Notename="Hihat";

Because if you show me how to declare that object i can fill in the blanks myself, "because i am totally clueless how to declare that nested object?

Is it a correct structured object insertion/assignment, and such object is possible to create right?
If not what is wrong with it?

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


#36424

Fromjonas.thornvall@gmail.com
Date2019-04-25 23:56 -0700
Message-ID<b713619a-65cc-4171-8192-502a1ab57141@googlegroups.com>
In reply to#36423
Den fredag 26 april 2019 kl. 08:41:28 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 25 april 2019 kl. 19:37:51 UTC+2 skrev John G Harris:
> > On Thu, 25 Apr 2019 09:12:15 -0700 (PDT), groovee@cyberdude.com wrote:
> > 
> > >On Thursday, 25 April 2019 14:46:25 UTC+5:30, jonas.t...@gmail.com  wrote:
> > >
> > >> 
> > >> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...
> > >
> > >
> > >I didn't read all of your post, but - I have often felt the exact same! :) WTF is "document.getElementById("blah").addEventListener" ANYWAY? You have to do THAT MUCH to register a simple event handler?
> > 
> > How then would you say which part of the document that event handler
> > should be associated with?
> > 
> > 
> > >....and I TILL DATE (and I've been battling with JS for a while now) don't understand what TWO DOTS (as above) mean - to me, it's incomprehensible :(
> > 
> > You want to do something to the b part of a. One notation to get to it
> > is a<b>; another is  b of a ; a more popular one is a.b .
> > 
> > Obviously, if b has a c part you get to it by doing a.b.c . Or would
> > you prefer c of b of a ?
> > 
> >   John
> 
> Hello John, i just need to know, ***how do i declare this nested object***, either i am  fucking stupid because i can't find any similar examples, and i really tried to figure it out by myself ***trial and error*** mostly error LoL
> 
> Synth[i].Bank[j].Instrument[k].Note[l].Notename="Hihat";
> 
> Because if you show me how to declare that object i can fill in the blanks myself, "because i am totally clueless how to declare that nested object?
> 
> Is it a correct structured object insertion/assignment, and such object is possible to create right?
> If not what is wrong with it?

How can it be that they made something as selfevident like below almost impssible to figure out howto implement? 
Is it just me that have a hard time with new syntax, or is it something wrong with the implementation structure?
I would say i am very logical, and proven very smart with IQ tests, yet i fail miserable with reading/understanding javascript syntax, to me it is just jibberish, layers of mishmash?

Obj. Synth:
   //  Prop.
   Synth[](InstrumentIndex,InstrumentName,Bank)
   //  SubProp/obj. 
   Bank[](Bankindex,Bankname,(Instrument)) 
   //  SubProp/obj. 
   Instrument[](Instrumentindex,Instrumentname,(Note)) 
   //  SubProp.     
   Note[](Notename);

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


#36425

Fromjonas.thornvall@gmail.com
Date2019-04-26 00:00 -0700
Message-ID<7efc93ef-d37c-467b-a686-18a36f3bf9e8@googlegroups.com>
In reply to#36424
Den fredag 26 april 2019 kl. 08:56:13 UTC+2 skrev jonas.t...@gmail.com:
> Den fredag 26 april 2019 kl. 08:41:28 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 25 april 2019 kl. 19:37:51 UTC+2 skrev John G Harris:
> > > On Thu, 25 Apr 2019 09:12:15 -0700 (PDT), groovee@cyberdude.com wrote:
> > > 
> > > >On Thursday, 25 April 2019 14:46:25 UTC+5:30, jonas.t...@gmail.com  wrote:
> > > >
> > > >> 
> > > >> The fucking syntax of javascript objects is unbearable and uncomprehensible, the fucker who came up with it must be clinically insane...
> > > >
> > > >
> > > >I didn't read all of your post, but - I have often felt the exact same! :) WTF is "document.getElementById("blah").addEventListener" ANYWAY? You have to do THAT MUCH to register a simple event handler?
> > > 
> > > How then would you say which part of the document that event handler
> > > should be associated with?
> > > 
> > > 
> > > >....and I TILL DATE (and I've been battling with JS for a while now) don't understand what TWO DOTS (as above) mean - to me, it's incomprehensible :(
> > > 
> > > You want to do something to the b part of a. One notation to get to it
> > > is a<b>; another is  b of a ; a more popular one is a.b .
> > > 
> > > Obviously, if b has a c part you get to it by doing a.b.c . Or would
> > > you prefer c of b of a ?
> > > 
> > >   John
> > 
> > Hello John, i just need to know, ***how do i declare this nested object***, either i am  fucking stupid because i can't find any similar examples, and i really tried to figure it out by myself ***trial and error*** mostly error LoL
> > 
> > Synth[i].Bank[j].Instrument[k].Note[l].Notename="Hihat";
> > 
> > Because if you show me how to declare that object i can fill in the blanks myself, "because i am totally clueless how to declare that nested object?
> > 
> > Is it a correct structured object insertion/assignment, and such object is possible to create right?
> > If not what is wrong with it?
> 
> How can it be that they made something as selfevident like below almost impssible to figure out howto implement? 
> Is it just me that have a hard time with new syntax, or is it something wrong with the implementation structure?
> I would say i am very logical, and proven very smart with IQ tests, yet i fail miserable with reading/understanding javascript syntax, to me it is just jibberish, layers of mishmash?
> 
> Obj. Synth:
>    //  Prop.
>    Synth[](InstrumentIndex,InstrumentName,Bank)
>    //  SubProp/obj. 
>    Bank[](Bankindex,Bankname,(Instrument)) 
>    //  SubProp/obj. 
>    Instrument[](Instrumentindex,Instrumentname,(Note)) 
>    //  SubProp.     
>    Note[](Notename);

Well i guess i missed the parenthese around Bank, but i guess you saw that.

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


#36429

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2019-04-26 10:45 +0100
Message-ID<jnk5cehnidqfu0q591oau3ptqmq4bngcg2@4ax.com>
In reply to#36423
On Thu, 25 Apr 2019 23:41:19 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

  <snip>
>Hello John, i just need to know, ***how do i declare this nested object***, either i am  fucking stupid because i can't find any similar examples, and i really tried to figure it out by myself ***trial and error*** mostly error LoL
>
>Synth[i].Bank[j].Instrument[k].Note[l].Notename="Hihat";
  <snip>

The structure is a tree. You don't declare it, you build it. Well, you
do have to declare the object that holds it all.


  var synths = [];  
    // The top (or is it the bottom?) of the tree structure

  synths[i] = newSynth();  
    // That's one of your synth objects created

  synths[i].banks[j] = newBank();
    // That's one of its bank objects created

  synths[i].banks[j].instruments[k] = newInstrument();
    // That's one of its instrument objects created

  synths[i].banks[j].instruments[k].notes[l] = newNote();
    // That's one of its note objects created

  synths[i].banks[j].instruments[k].notes[l].name = "Hihat";
    // That's the note object given a name

  John

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


#36432

Fromjonas.thornvall@gmail.com
Date2019-04-26 04:37 -0700
Message-ID<a3187f17-fe6f-4f52-b1bf-49a31435a290@googlegroups.com>
In reply to#36429
Den fredag 26 april 2019 kl. 11:45:53 UTC+2 skrev John G Harris:
> On Thu, 25 Apr 2019 23:41:19 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
> >Hello John, i just need to know, ***how do i declare this nested object***, either i am  fucking stupid because i can't find any similar examples, and i really tried to figure it out by myself ***trial and error*** mostly error LoL
> >
> >Synth[i].Bank[j].Instrument[k].Note[l].Notename="Hihat";
>   <snip>
> 
> The structure is a tree. You don't declare it, you build it. Well, you
> do have to declare the object that holds it all.
> 
> 
>   var synths = [];  
>     // The top (or is it the bottom?) of the tree structure
> 
>   synths[i] = newSynth();  
>     // That's one of your synth objects created
> 
>   synths[i].banks[j] = newBank();
>     // That's one of its bank objects created
> 
>   synths[i].banks[j].instruments[k] = newInstrument();
>     // That's one of its instrument objects created
> 
>   synths[i].banks[j].instruments[k].notes[l] = newNote();
>     // That's one of its note objects created
> 
>   synths[i].banks[j].instruments[k].notes[l].name = "Hihat";
>     // That's the note object given a name
> 
>   John

That is probably all i needed John big thanks to you!
What is the difference between a nested object and a tree?

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


#36440

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2019-04-26 19:41 +0100
Message-ID<i5k6cehp2oede5n8eark4o9llji561h8r4@4ax.com>
In reply to#36432
On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

  <snip>
>What is the difference between a nested object and a tree?

"tree" is a general name. A tree can be implemented in many ways. A
nested object is one way. (And there may be several meanings of
"nested object".)

  John

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


#36441

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-04-26 21:11 +0200
Message-ID<XnsAA3DD7975A507eejj99@194.109.6.166>
In reply to#36440
John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
comp.lang.javascript:

> On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
>>What is the difference between a nested object and a tree?
> 
> "tree" is a general name. A tree can be implemented in many ways. A
> nested object is one way. (And there may be several meanings of
> "nested object".)

In JS:

There is no such thing as a "nested object" as a SPECIAL object.

It is just that an element of an object can be an object itself,
so you could call it a "nested object", but that is just its location.

Indeed, a "tree" is just a way of viewing and organizing a related buch of 
data, independent of if you use an object, an array, just a naming 
convention, etc.

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

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


#36442

Fromjonas.thornvall@gmail.com
Date2019-04-26 13:23 -0700
Message-ID<ee2dcf9c-ba87-4a8f-ac5a-31b8637bbc26@googlegroups.com>
In reply to#36441
Den fredag 26 april 2019 kl. 21:12:12 UTC+2 skrev Evertjan.:
> John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
> comp.lang.javascript:
> 
> > On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
> > wrote:
> > 
> >   <snip>
> >>What is the difference between a nested object and a tree?
> > 
> > "tree" is a general name. A tree can be implemented in many ways. A
> > nested object is one way. (And there may be several meanings of
> > "nested object".)
> 
> In JS:
> 
> There is no such thing as a "nested object" as a SPECIAL object.
> 
> It is just that an element of an object can be an object itself,
> so you could call it a "nested object", but that is just its location.
> 
> Indeed, a "tree" is just a way of viewing and organizing a related buch of 
> data, independent of if you use an object, an array, just a naming 
> convention, etc.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Given this pseudo code "disregard my comments"
Would you call it an object or a tree?

And how would ***you*** chose to  implement it in Javascript Evertjan a tree or object? If you have trouble decode my pseudo syntax do not hesitate to ask. Because subject i do not fullly understand interest me.

Obj. Synth: 
   //  Prop. 
   Synth[](InstrumentIndex,InstrumentName,Bank) 
   //  SubProp/obj. 
   Bank[](Bankindex,Bankname,(Instrument)) 
   //  SubProp/obj. 
   Instrument[](Instrumentindex,Instrumentname,(Note)) 
   //  SubProp.     
   Note[](Notename); 

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


#36448

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-04-26 23:32 +0200
Message-ID<XnsAA3DEF7E3DD87eejj99@194.109.6.166>
In reply to#36442
jonas.thornvall@gmail.com wrote on 26 Apr 2019 in comp.lang.javascript:

> Den fredag 26 april 2019 kl. 21:12:12 UTC+2 skrev Evertjan.:
>> John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
>> comp.lang.javascript:
>> 
>> > On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
>> > wrote:
>> > 
>> >   <snip>
>> >>What is the difference between a nested object and a tree?
>> > 
>> > "tree" is a general name. A tree can be implemented in many ways. A
>> > nested object is one way. (And there may be several meanings of
>> > "nested object".)
>> 
>> In JS:
>> 
>> There is no such thing as a "nested object" as a SPECIAL object.
>> 
>> It is just that an element of an object can be an object itself,
>> so you could call it a "nested object", but that is just its location.
>> 
>> Indeed, a "tree" is just a way of viewing and organizing a related buch
>> of data, independent of if you use an object, an array, just a naming 
>> convention, etc.
>> 
>> -- 
>> Evertjan.
>> The Netherlands.
>> (Please change the x'es to dots in my emailaddress)
> 
> Given this pseudo code "disregard my comments"
> Would you call it an object or a tree?
> 
> And how would ***you*** chose to  implement it in Javascript Evertjan a
> tree or object? If you have trouble decode my pseudo syntax do not
> hesitate to ask. Because subject i do not fullly understand interest me. 
> 
> Obj. Synth: 
>    //  Prop. 
>    Synth[](InstrumentIndex,InstrumentName,Bank) 
>    //  SubProp/obj. 
>    Bank[](Bankindex,Bankname,(Instrument)) 
>    //  SubProp/obj. 
>    Instrument[](Instrumentindex,Instrumentname,(Note)) 
>    //  SubProp.     
>    Note[](Notename); 

const  Synth = {};

Deeper down, I don't understand what your pseudocode means.

I could guess, but it seems to me it is your task to work it out.

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

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


#36450

Fromjonas.thornvall@gmail.com
Date2019-04-26 15:11 -0700
Message-ID<7142e9c4-583d-4456-a946-1cb183fd0f51@googlegroups.com>
In reply to#36448
Den fredag 26 april 2019 kl. 23:32:39 UTC+2 skrev Evertjan.:
> jonas.thornvall@gmail.com wrote on 26 Apr 2019 in comp.lang.javascript:
> 
> > Den fredag 26 april 2019 kl. 21:12:12 UTC+2 skrev Evertjan.:
> >> John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
> >> comp.lang.javascript:
> >> 
> >> > On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
> >> > wrote:
> >> > 
> >> >   <snip>
> >> >>What is the difference between a nested object and a tree?
> >> > 
> >> > "tree" is a general name. A tree can be implemented in many ways. A
> >> > nested object is one way. (And there may be several meanings of
> >> > "nested object".)
> >> 
> >> In JS:
> >> 
> >> There is no such thing as a "nested object" as a SPECIAL object.
> >> 
> >> It is just that an element of an object can be an object itself,
> >> so you could call it a "nested object", but that is just its location.
> >> 
> >> Indeed, a "tree" is just a way of viewing and organizing a related buch
> >> of data, independent of if you use an object, an array, just a naming 
> >> convention, etc.
> >> 
> >> -- 
> >> Evertjan.
> >> The Netherlands.
> >> (Please change the x'es to dots in my emailaddress)
> > 
> > Given this pseudo code "disregard my comments"
> > Would you call it an object or a tree?
> > 
> > And how would ***you*** chose to  implement it in Javascript Evertjan a
> > tree or object? If you have trouble decode my pseudo syntax do not
> > hesitate to ask. Because subject i do not fullly understand interest me. 
> > 
> > Obj. Synth: 
> >    //  Prop. 
> >    Synth[](InstrumentIndex,InstrumentName,Bank) 
> >    //  SubProp/obj. 
> >    Bank[](Bankindex,Bankname,(Instrument)) 
> >    //  SubProp/obj. 
> >    Instrument[](Instrumentindex,Instrumentname,(Note)) 
> >    //  SubProp.     
> >    Note[](Notename); 
> 
> const  Synth = {};
> 
> Deeper down, I don't understand what your pseudocode means.
> 
> I could guess, but it seems to me it is your task to work it out.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

No i fully did get John G Harris answer he basicly said that Javascript can't handle instances of arrays in an object, It can't nest them so instead one create a tree structure, i fully can accept and implement that to my satisfacion but really can't see why it could not be a nested object.


 var synths = [];   
    // The top (or is it the bottom?) of the tree structure 

  synths[i] = newSynth();   
    // That's one of your synth objects created 

  synths[i].banks[j] = newBank(); 
    // That's one of its bank objects created 

  synths[i].banks[j].instruments[k] = newInstrument(); 
    // That's one of its instrument objects created 

  synths[i].banks[j].instruments[k].notes[l] = newNote(); 
    // That's one of its note objects created 

  synths[i].banks[j].instruments[k].notes[l].name = "Hihat"; 
    // That's the note object given a name 

  John

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


#36451

Fromjonas.thornvall@gmail.com
Date2019-04-26 15:24 -0700
Message-ID<8ea94ad2-00f1-4080-9b70-310072211075@googlegroups.com>
In reply to#36448
Den fredag 26 april 2019 kl. 23:32:39 UTC+2 skrev Evertjan.:
> jonas.thornvall@gmail.com wrote on 26 Apr 2019 in comp.lang.javascript:
> 
> > Den fredag 26 april 2019 kl. 21:12:12 UTC+2 skrev Evertjan.:
> >> John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
> >> comp.lang.javascript:
> >> 
> >> > On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
> >> > wrote:
> >> > 
> >> >   <snip>
> >> >>What is the difference between a nested object and a tree?
> >> > 
> >> > "tree" is a general name. A tree can be implemented in many ways. A
> >> > nested object is one way. (And there may be several meanings of
> >> > "nested object".)
> >> 
> >> In JS:
> >> 
> >> There is no such thing as a "nested object" as a SPECIAL object.
> >> 
> >> It is just that an element of an object can be an object itself,
> >> so you could call it a "nested object", but that is just its location.
> >> 
> >> Indeed, a "tree" is just a way of viewing and organizing a related buch
> >> of data, independent of if you use an object, an array, just a naming 
> >> convention, etc.
> >> 
> >> -- 
> >> Evertjan.
> >> The Netherlands.
> >> (Please change the x'es to dots in my emailaddress)
> > 
> > Given this pseudo code "disregard my comments"
> > Would you call it an object or a tree?
> > 
> > And how would ***you*** chose to  implement it in Javascript Evertjan a
> > tree or object? If you have trouble decode my pseudo syntax do not
> > hesitate to ask. Because subject i do not fullly understand interest me. 
> > 
> > Obj. Synth: 
> >    //  Prop. 
> >    Synth[](InstrumentIndex,InstrumentName,Bank) 
> >    //  SubProp/obj. 
> >    Bank[](Bankindex,Bankname,(Instrument)) 
> >    //  SubProp/obj. 
> >    Instrument[](Instrumentindex,Instrumentname,(Note)) 
> >    //  SubProp.     
> >    Note[](Notename); 
> 
> const  Synth = {};
> 
> Deeper down, I don't understand what your pseudocode means.
> 
> I could guess, but it seems to me it is your task to work it out.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

You see my simple object description is superior in functionality to the javascript one "that is really just nonesense", and have a semantic context, that javascript simply lack. And my would people remember after reading its structure one time. You see my simple syntax can handle tree structures.
It has a simple object statement, a simple start Obj. X: a simple end ; and it have meaning and context for the tree. One can lock at it and see the Object divided into properties and subobjects. Someone who never programmed a single line could figure it out by just looking. Well they had to learn that [] means array, but apart from that my object is selfexplanatory, and evidently it hold functionality the javascript object can't hold, it is simply a superior storage structure. Can you imagine how short and concise it is compared to javascripts mishmash of blipblopping nonesense?

Yeah i know it is fantastic.

Obj. Synth: 
   //  Prop. 
   Synth[](InstrumentIndex,InstrumentName,(Bank)) 
   //  SubProp/obj. 
   Bank[](Bankindex,Bankname,(Instrument)) 
   //  SubProp/obj. 
   Instrument[](Instrumentindex,Instrumentname,(Note)) 
   //  SubProp.     
   Note[](NoteIndex,Notename);

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


#36452

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-04-27 11:52 +0200
Message-ID<XnsAA3E78E0BA3C0eejj99@194.109.6.166>
In reply to#36451
jonas.thornvall@gmail.com wrote on 27 Apr 2019 in comp.lang.javascript:

> Yeah i know it is fantastic.

Trump.

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

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


#36454

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2019-04-27 11:17 +0100
Message-ID<80b8cetatc7c1ravkhri00bigv05rkesjq@4ax.com>
In reply to#36442
On Fri, 26 Apr 2019 13:23:36 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

  <snip>
>And how would ***you*** chose to  implement it in Javascript Evertjan a tree or object? If you have trouble decode my pseudo syntax do not hesitate to ask. Because subject i do not fullly understand interest me.

Don't call it
  >Obj. Synth: 
Call it Structure Synth until you have decided how you are going to
implement it.

>   //  Prop. 
>   Synth[](InstrumentIndex,InstrumentName,Bank) 
a) This is different from your original description. Why ?

b) What is an "index" ?

>   //  SubProp/obj. 
>   Bank[](Bankindex,Bankname,(Instrument)) 
>   //  SubProp/obj. 
>   Instrument[](Instrumentindex,Instrumentname,(Note)) 
>   //  SubProp.     
>   Note[](Notename); 

  John

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


#36458

Fromjonas.thornvall@gmail.com
Date2019-04-27 05:00 -0700
Message-ID<c399eb0a-e754-4e8c-a830-a8b9190395c6@googlegroups.com>
In reply to#36454
Den lördag 27 april 2019 kl. 12:17:10 UTC+2 skrev John G Harris:
> On Fri, 26 Apr 2019 13:23:36 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
> >And how would ***you*** chose to  implement it in Javascript Evertjan a tree or object? If you have trouble decode my pseudo syntax do not hesitate to ask. Because subject i do not fullly understand interest me.
> 
> Don't call it
>   >Obj. Synth: 
> Call it Structure Synth until you have decided how you are going to
> implement it.
> 
> >   //  Prop. 
> >   Synth[](InstrumentIndex,InstrumentName,Bank) 
> a) This is different from your original description. Why ?
> 
> b) What is an "index" ?
> 
> >   //  SubProp/obj. 
> >   Bank[](Bankindex,Bankname,(Instrument)) 
> >   //  SubProp/obj. 
> >   Instrument[](Instrumentindex,Instrumentname,(Note)) 
> >   //  SubProp.     
> >   Note[](Notename); 
> 
>   John

Well in this case an index is just a numerical value to reach bank, instrument. Because they are not populated fully from 0-127, so you could use the array index but that would mean alot of null values in array. So better have the programNr, bankNr and noteNr separate "sorry if calling them index was confusing but they sort of are the index of the note, instrument and bank. Mr maybe better.

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


#36459

Fromjonas.thornvall@gmail.com
Date2019-04-27 05:06 -0700
Message-ID<2957b3e6-788a-4bb9-95fd-15a47bce5663@googlegroups.com>
In reply to#36454
Den lördag 27 april 2019 kl. 12:17:10 UTC+2 skrev John G Harris:
> On Fri, 26 Apr 2019 13:23:36 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
> 
>   <snip>
> >And how would ***you*** chose to  implement it in Javascript Evertjan a tree or object? If you have trouble decode my pseudo syntax do not hesitate to ask. Because subject i do not fullly understand interest me.
> 
> Don't call it
>   >Obj. Synth: 
> Call it Structure Synth until you have decided how you are going to
> implement it.
> 
> >   //  Prop. 
> >   Synth[](InstrumentIndex,InstrumentName,Bank) 
> a) This is different from your original description. Why ?
> 
> b) What is an "index" ?
> 
> >   //  SubProp/obj. 
> >   Bank[](Bankindex,Bankname,(Instrument)) 
> >   //  SubProp/obj. 
> >   Instrument[](Instrumentindex,Instrumentname,(Note)) 
> >   //  SubProp.     
> >   Note[](Notename); 
> 
>   John

From the synths view the index is the message that it receive "bankchange,programchange,note"

You could call it number instead, bankNr,progNr,notenr.

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


#36453

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2019-04-27 11:08 +0100
Message-ID<efa8cetshemks7mietlpp9os8m9h6jr02b@4ax.com>
In reply to#36441
On Fri, 26 Apr 2019 21:11:36 +0200, "Evertjan."
<exxjxw.hannivoort@inter.nl.net> wrote:

>John G Harris <niam@jghnorth.org.uk.invalid> wrote on 26 Apr 2019 in 
>comp.lang.javascript:
>
>> On Fri, 26 Apr 2019 04:37:49 -0700 (PDT), jonas.thornvall@gmail.com
>> wrote:
>> 
>>   <snip>
>>>What is the difference between a nested object and a tree?
>> 
>> "tree" is a general name. A tree can be implemented in many ways. A
>> nested object is one way. (And there may be several meanings of
>> "nested object".)
>
>In JS:
>
>There is no such thing as a "nested object" as a SPECIAL object.

An object's properties, each a (name, value) couple, can be described
as inside the object. Then you can say they are nested, and "nested
object" is a short and fluffy description of a complicated object.

Or you can say each property is attached to the object by a piece of
string and is outside the object. Then the structure has a tree shape.


>It is just that an element of an object can be an object itself,
>so you could call it a "nested object", but that is just its location.
>
>Indeed, a "tree" is just a way of viewing and organizing a related buch of 
>data, independent of if you use an object, an array, just a naming 
>convention, etc.

Here is another tree structure :

  [ [ ] [ [ ] ] [ [ [ ] [ ] ] ] ]

Or you could call it nested brackets. It's your choice.

  John

[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