Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35728
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2018-10-02 12:47 -0700 |
| References | (6 earlier) <00784e15-1f90-4d76-bdc1-475bd1f2191d@googlegroups.com> <re9pqdhhena4m8hhlaeslgju5uvtma4obe@4ax.com> <f91f4ded-44c1-44c9-823d-1a3ada97648b@googlegroups.com> <m49qqdt8mtmn94balupllsso3h8e4do9d7@4ax.com> <46cf39ce-0411-f576-198a-21b876b1b45d@PointedEars.de> |
| Message-ID | <a5028a2d-ca08-4ade-8734-06b7fdc925d0@googlegroups.com> (permalink) |
| Subject | Re: Ideas behind programming language syntax choices? |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den fredag 28 september 2018 kl. 21:04:41 UTC+2 skrev Thomas 'PointedEars' Lahn:
> </killfile>
>
> John G Harris wrote:
> > On Thu, 27 Sep 2018 03:38:09 -0700 (PDT), Jonas Thörnvall
> > <jonas.thornvall@gmail.com> wrote:
> >
> > <snip>
> >> Your point is lost to me.
> >
> > You don't know what a[3] means in this or any other programming
> > language. No wonder we are having trouble helping you.
>
> To be fair, not all operations work the same in all programming languages.
>
> IIRC, Jonas Thörnvall was coming from Python (a programming language that
> I like, too), in which there is
>
> ".".join(["foo", "bar"]) == "foo.bar"
>
> "foo.bar".split(".")
>
> instead of the ECMAScript-like
>
> ["foo", "bar"].join(".") == "foo.bar"
>
> "foo.bar".split(".")
>
> (I find the latter more intuitive, but the former is just how things work
> in Python. One must learn to accept the things that one cannot change.)
>
> So someone with superficial knowledge in programming in general, or Python
> in particuloar, could get the idea that it should always work in the former way.
>
> With that said,
>
> a[3]
>
> for an object referred to by “a” that is an instance of a subtype/subclass
> of the “list” type/class conceptually works exactly the same in Python as it
> does in ECMAScript for an Array-like object referred to by “a”, e.g.
>
> ["foo", "bar", "baz", "bla"][3] == "bla"
>
> in both languages/language families.
>
> As you indicated, it matters what an expression resolves to. Chaining
> cannot be arbitrary.
>
> track[recTrack].midiMess[trackevent].splice(1);
>
> to splice
>
> track[recTrack].midiMess
>
> would require an unnecessarily complex implementation where an element of a
> list/Array-like object would have to keep a reference to its owner so that
> it "knew" what the owner’s element with index 1 was. As an element can be a
> reference to an object, and that object can be referred by several other
> objects (“owners”), there is no clear owner for a referred object, and
> automatically modifying all owners is not only inefficient, it also usually
> makes no sense.
>
> ,---------. ,------------. ,---------.
> track --->: : Array : : : Object : : : Array :
> :---------: :------------: :---------: ,-----------------.
> : +0 -------->: +midiMess ---->: +0 -------->: : Object :
> : +1 : `------------' : +1 : :-----------------:
> : ... : : +2 : : ... :
> : : `---------' : :
> : : : :
> `---------' ,------------. :-----------------:
> : : Function :<--- +splice(Number) :
> :------------: `-----------------'
> : ... : ^
> :------------: : What
> : -[[Call]] : : now?
> : ... : :
> `------------' myTrack
>
> [That is why I recommended to draw a diagram.]
>
> This would also violate the *Law of Demeter*, which for object-oriented
> programming can be formulated as follows:
>
> An object should only access its *own* properties directly; access to the
> properties of other objects should be performed using only the methods
> provided by those objects.
>
> [“property” means only non-callable attributes of an object here.
> This is not generally true in ECMAScript where methods are implemented
> as properties whose value is a reference to a callable object. Also,
> implicit getters and setters, methods *declaratively* attached to read
> and write access to a property, blur the difference between properties
> and methods (in that sense).]
>
> Otherwise, if the internal data structure encapsulated by the other object
> would change, the direct property accesses in the accessing code would have
> to be modified as well.
>
> <https://en.wikipedia.org/wiki/Law_of_Demeter>
>
> It is often indicated by one or more leading underscore characters [“_”] in
> the property/attribute name that a property/attribute is not suited to be
> referenced directly from outside the object’s code. Those
> properties/attributes are often implemented or designated “private” or
> “protected”.
>
> AFAIK, in all current ECMAScript implementations this distinction still
> cannot be declared built-in; workarounds like the module pattern exist instead.
>
> See also:
>
> <https://github.com/tc39/proposal-class-fields#private-fields>
>
> found in
>
> <https://stackoverflow.com/a/52237988/855543>
>
> and
>
> <https://tc39.github.io/proposal-class-fields/>
>
> found through
>
> <https://stackoverflow.com/a/22160051/855543>
>
>
> <killfile>
>
> --
> 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.
Well Thomas you seem to think that the semantic choice that makeup/create the of syntax should reflect, how things stored internally.
That is just bullocks and you know it. No it should reflect what people intend to do in simplest most obvious manner.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-21 21:53 -0700
Re: Ideas behind programming language syntax choices? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-22 15:17 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 10:23 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 10:31 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 10:39 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 11:20 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 15:21 -0700
Re: Ideas behind programming language syntax choices? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-23 09:14 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 00:23 -0700
Re: Ideas behind programming language syntax choices? Maik Koenig <usenetspam@maikkoenig.de> - 2018-09-24 00:56 +0200
Re: Ideas behind programming language syntax choices? Silvio <silvio@internet.com> - 2018-09-24 00:33 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:07 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:13 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:24 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:37 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-09-25 19:52 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 12:15 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 12:35 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-09-26 18:31 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 11:28 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-09-27 10:49 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-27 03:38 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-09-27 19:42 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-27 14:44 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-27 14:48 -0700
Re: Ideas behind programming language syntax choices? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-28 21:04 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-10-02 12:47 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-03 18:19 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-10-04 05:43 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-05 18:17 +0100
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-10-05 22:37 +0200
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-06 14:30 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-10-07 09:57 -0700
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-10-07 23:08 +0200
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-08 19:43 +0100
Re: Ideas behind programming language syntax choices? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-10-06 18:04 +0200
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-07 10:14 +0100
Re: Ideas behind programming language syntax choices? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-10-07 15:15 +0200
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-09 10:38 +0100
Re: Ideas behind programming language syntax choices? dr.s.lartius@gmail.com - 2018-10-09 08:27 -0700
Re: Ideas behind programming language syntax choices? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-10-09 19:12 +0100
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:52 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 16:56 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 17:02 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 18:06 -0700
Re: Ideas behind programming language syntax choices? Silvio <silvio@internet.com> - 2018-09-24 23:51 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 01:58 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 02:25 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 02:51 -0700
Re: Ideas behind programming language syntax choices? Silvio <silvio@internet.com> - 2018-09-25 19:41 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 11:22 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 11:42 -0700
Re: Ideas behind programming language syntax choices? Silvio <silvio@internet.com> - 2018-09-25 21:47 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 14:24 -0700
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-09-25 23:37 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 14:46 -0700
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-09-26 10:52 +0200
Re: Ideas behind programming language syntax choices? Silvio <silvio@internet.com> - 2018-09-26 00:06 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 15:55 -0700
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-09-26 10:58 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 02:48 -0700
Re: Ideas behind programming language syntax choices? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-09-26 12:30 +0200
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 04:45 -0700
Re: Ideas behind programming language syntax choices? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 04:53 -0700
csiph-web