Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36479
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-04-29 08:31 -0700 |
| References | (4 earlier) <jnk5cehnidqfu0q591oau3ptqmq4bngcg2@4ax.com> <d4cece83-66ea-48d9-8ba5-f6c0a4fcb579@googlegroups.com> <qa4jc3$13h4$1@gioia.aioe.org> <3e84754a-df88-4f4a-a328-d6d685b56a22@googlegroups.com> <qa6pl5$19hi$1@gioia.aioe.org> |
| Message-ID | <916ffee0-8868-4c02-92df-8dc6b72de44f@googlegroups.com> (permalink) |
| Subject | Re: Objects what are they. |
| From | jonas.thornvall@gmail.com |
Den måndag 29 april 2019 kl. 14:11:28 UTC+2 skrev R.Wieser: > Jonas, > > > No, what i have been after from beginning is that the whole > > tree "structure" is *ONE* object, not stringed together objects. > > I do not quite understand what the problem with the "stringed together" > version is. You can move the whole thing around by moving the root object > around. Deleting the root object will automatically delete all child > objects too (deleting an object will automatically delete all objects it > references - regardless of them being variables, string, arrays or actual > objects) > > > I consider it a synth content object. Not four objects that > > should be stringed together. > > Yes, that is what you should /consider/ it as. But you /build/ it by > adding parts-and-bits to it. > > > Do you understand what i am after? > > Yes. I think I do. But I get the feeling that you're standing infront of > a forrest but do not see it, because all you notice is a bunch of seperate > trees (no offense intended mind you). > > > I do not see why i would have to build the object, from objects. > > You do not /have/ to. You can simply create a single, big (and fixed in all > but the last dimension) array and use that. > > But there are a number of drawbacks connected to such an approach, like > needing to declare each-and-very area to store the "notes" in big enough to > store the longest string of notes for /any/ instrument. Same for the > "banks" (large enough to store the maximum expected number of instruments > in). > > Thats wil most likely be rather wastefull (just imagine an instrument which > just plays a few notes - triangles anyone ? :-) ), as well as impossible to > add more banks, instruments and/or notes than you accounted for while > creating the big array. > > In short, using those objects might look hard, but they give you quite a bit > of flexibility in handling you "Synth" (with all in it). And that includes > to be able to insert or delete banks, instruments and notes at will. > > > No the (bank,instument,note)(index) is just numbers so it > > would be a waiste constructing notes for every intruments. > > I'm sorry, but I do not see your above description back in the message I > replied to. I hower /do/ see this: > > >>> Synth[](InstrumentIndex,InstrumentName,(Bank)) > ... > >>> Instrument[](Instrumentindex,Instrumentname,(Note)) > > Also, if you do not want to build outof parts that you also cannot build an > array and than put other arrays into it. That would be cheating. :-) > > > It is ONE synth object "could be an array holding many synths" > > Ah. An object that holds multiple versions of itself ? And you're > surprised nobody picked up on that ? > > > not just one, one synth holding banks, each banks holding instruments, > > some instrument holding named notes. > > But whats the problem ? Both John and I already showed you that you can > have a "Banks" array which can contain many "bank" objects (notice that the > first ends with an "s" (as in multiple), while the latter does not). And > we repeated that for/with the "Instruments" array holding "Instrument" > objects. You can do *the exact same* for your above problem: A "Synths" > array holding multiple "Synth" objects. > > The new "simple" description would than become: > > Synths[Synth[Banks[BankName,Instruments[InstrumentName,Notes[NoteName]]]]] > > Presto! A "Synths" array holding multiple "Synth" objects which hold ... > etc, etc,etc. > > > And banks are not listed for 0-X they can start bank 47 nest 70 and so on. > > 1) Do you think we are mindreaders ? What you do not tell us we do not > know. > > 2) Have you ever thought about naming your variables in a way that they > actually indicate what they are for ? Like, I don't know, "BankFirstIndex" > or "BankIndexOffset" perhaps ? > > And if you do it that way, good luck with situations where you use a few > banks, than a few not, and than again a few. How are you going to solve > that ? :-) > > As for a possible solution, you can use any associative array instead, with > the "key" being the 'index number' of the bank, and the "data" belonging to > that "key" the bank array/object itself. That way you only store the banks > that are truly in use. > > Ofcourse, you won't be able to use a simple "by index" anymore. Than again, > when you use a "this variable signifies the offset to the first bank" you > already needed to sprinkle some "magic" over it. The above (associative > array method) just makes it a bit different (and quite likely even simpler). > > Blimy! I just realized something: you are probably using the "bank"s to > solve that above "use a few (instruments -> notes), some not and than again > some" I spoke of. Odd. I would have expected it to be applied on the > notes themselves. Oh well. Well it is all a hierarchy of arrays, and as you say use "the actual banknumbers, the actual instrumentnumbers, and notenumbers" by having them in array index you will indeed make some sort of monster. So it is better they are properties. Because then you only fill array slots actually containing something. And you do not have to search for them in an array full of null values. No i understand the Javascript approach now and have no problem with it. But it is not *selfevident* that is the way to "declare" the object. Because for someone reading the code it become strange indeed. If the object had a simpler structure like i proposed it is easier to take in what that structure is. Now that object become a bit vague for someone who read, when you string together. And the biggest problem people like me just do not understand howto create such, because there is no examples of such objects to find in documentation. So it become guesswork, no i would never had thought you made the synth object by string together object, i thought it was a single declaration and of a structure of sort. So all is well i do get it, what i say is people can not figure it out on their own howto create that structure? object?, because they will try to make an object like me. I would prefered it the other way around, but that is taste i guess. That is what i mean it is a bit vague what it is, i am still not sure if it is a tree structure or an object. It become so vague when you string things together. > > Regards, > Rudy Wieser
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web