Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26465 > unrolled thread
| Started by | "Tony Johansson" <johansson.andersson@telia.com> |
|---|---|
| First post | 2015-01-06 00:48 +0100 |
| Last post | 2015-01-08 11:33 +0100 |
| Articles | 20 on this page of 70 — 10 participants |
Back to article view | Back to comp.lang.javascript
Can somebody explain this to me "Tony Johansson" <johansson.andersson@telia.com> - 2015-01-06 00:48 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-06 01:40 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-06 16:01 +0000
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-06 17:26 +0100
Re: Can somebody explain this to me Joao Rodrigues <groups_jr-1@yahoo.com> - 2015-01-07 00:45 -0200
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-07 04:35 +0100
Re: Can somebody explain this to me Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-01-07 16:15 -0200
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-07 21:20 +0100
Re: Can somebody explain this to me "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-08 00:00 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 00:09 +0100
Re: Can somebody explain this to me "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-08 10:53 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 16:17 +0100
Re: Can somebody explain this to me "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-08 17:04 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 19:02 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-07 15:37 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-07 17:01 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-08 10:43 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-08 13:16 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 16:43 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-09 20:16 +0000
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-09 22:11 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-10 16:58 +0000
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-11 12:41 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-12 15:46 +0000
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-12 18:01 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-13 10:38 +0000
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-14 16:06 +0000
Re: Can somebody explain this to me Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-21 13:00 -0800
Re: Can somebody explain this to me Joao Rodrigues <groups_jr-1@yahoo.com> - 2015-01-21 20:53 -0200
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-22 11:43 +0000
Re: Can somebody explain this to me Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-01-22 10:20 -0200
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-23 19:42 +0000
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-28 18:14 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-22 11:39 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-22 13:27 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-23 14:36 +0000
Re: Can somebody explain this to me Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-23 08:51 -0800
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-23 23:17 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-24 16:42 +0000
Re: Can somebody explain this to me Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-24 15:35 -0800
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-25 11:08 +0000
Re: Can somebody explain this to me "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-01-26 08:33 -0800
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-27 14:10 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-28 15:50 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-28 18:26 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-29 10:29 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-31 00:37 +0100
Re: Can somebody explain this to me "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-01-28 13:30 -0800
Re: Can somebody explain this to me "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-28 22:40 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-29 10:32 +0000
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-29 10:23 +0000
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-29 11:04 +0000
Re: Can somebody explain this to me "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-01-26 08:21 -0800
Re: Can somebody explain this to me Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-26 11:10 -0800
Re: Can somebody explain this to me Scott Sauyet <scott.sauyet@gmail.com> - 2015-01-22 06:36 -0800
Re: Can somebody explain this to me Tim Streater <timstreater@greenbee.net> - 2015-01-06 17:34 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-06 19:03 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-07 15:07 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-07 16:41 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-07 17:22 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-08 10:36 +0000
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-08 13:36 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 17:54 +0100
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-08 19:48 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 22:09 +0100
Re: Can somebody explain this to me Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-01-08 18:22 -0200
Re: Can somebody explain this to me "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-08 22:13 +0100
Re: Can somebody explain this to me Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-01-08 22:25 +0100
Re: Can somebody explain this to me John Harris <niam@jghnorth.org.uk.invalid> - 2015-01-08 10:25 +0000
Re: Can somebody explain this to me "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-01-08 11:33 +0100
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-25 11:08 +0000 |
| Message-ID | <8lj9catb74g72e1e4a2ga3os82a46cikb0@4ax.com> |
| In reply to | #26695 |
On Sat, 24 Jan 2015 15:35:32 -0800 (PST), Scott Sauyet <scott.sauyet@gmail.com> wrote: >John Harris wrote: >> If you replace the name 'prototype chain' with 'inheritance >> chain' you get a different view. A view that avoids any overspill from >> the ordinary meaning of 'prototype'. >> >> An inheritance chain is a linked list of objects that carry pointers >> (references) to own methods and inherited methods. I say that giving >> it the name 'prototype chain' was likely to mislead, and did do. > >I tend to think of inheritance as a static, compile-time feature. Because >prototype delegation is a dynamic, run-time feature, I prefer to separate >them entirely. Do you often alter a prototype chain that's in use ? How does the programmer know what to expect when accessing these objects ? John
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2015-01-26 08:33 -0800 |
| Message-ID | <06895b8e-d7f4-4dda-a8f2-00067c72246b@googlegroups.com> |
| In reply to | #26697 |
On Sunday, January 25, 2015 at 5:08:46 AM UTC-6, John Harris wrote:
> Do you often alter a prototype chain that's in use ?
>
> How does the programmer know what to expect when accessing these
> objects ?
This isn't as strange as you might think, and is relatively popular in the Self language for instance. The mode of thought is analogous in JS to this impressionistic example:
var openedFile = {
close: function(){ this.prototype = closedFile; },
write: function(){...},
...
}
var closedFile = {
open: function(){ this.prototype = openedFile; }
...
}
function File(){...}
File.prototype = Object.create(closedFile);
var file = new File(...)
file.open()
...
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-27 14:10 +0100 |
| Message-ID | <ma82n4$f6p$1@solani.org> |
| In reply to | #26697 |
John Harris wrote: > On Sat, 24 Jan 2015 15:35:32 -0800 (PST), Scott Sauyet > <scott.sauyet@gmail.com> wrote: > >> I tend to think of inheritance as a static, compile-time feature. Because >> prototype delegation is a dynamic, run-time feature, I prefer to separate >> them entirely. > > Do you often alter a prototype chain that's in use ? > > How does the programmer know what to expect when accessing these > objects ? Interesting questions for sure. However, earlier in this thread[1] you, John, claimed: | I don't think prototype chains make the ECMAScript language(s) a | prototypal language (you don't say that, but others do). And calling | it delegation-based prototyping confuses and obscures what's really | going on. IMHO, the ECMAScript language is a prototypal language, which allows to emulate class-based object models. [1] <news:20o1cal0k4iue9ic55hafskt53sivk7lmg@4ax.com> -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-28 15:50 +0000 |
| Message-ID | <681icahv1um1jp8hr1vhtq70qr9ku8c8h1@4ax.com> |
| In reply to | #26731 |
On Tue, 27 Jan 2015 14:10:00 +0100, "Christoph M. Becker" <cmbecker69@arcor.de> wrote: <snip> >IMHO, the ECMAScript language is a prototypal language, which allows to >emulate class-based object models. <snip> As you've probably realised, my opinion differs. I think that using the word 'prototype' in ECMAScript was unfortunate as it's not being used with the common meaning. There are languages that use 'prototype' with the common meaning. In them you create a new object by copying an existing object which acts its prototype. ECMAScript is not like this (whatever Wikipedia says). John
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-28 18:26 +0100 |
| Message-ID | <mab64q$845$1@solani.org> |
| In reply to | #26735 |
John Harris wrote: > On Tue, 27 Jan 2015 14:10:00 +0100, "Christoph M. Becker" > <cmbecker69@arcor.de> wrote: > > > <snip> >> IMHO, the ECMAScript language is a prototypal language, which allows to >> emulate class-based object models. > <snip> > > As you've probably realised, my opinion differs. I think that using > the word 'prototype' in ECMAScript was unfortunate as it's not being > used with the common meaning. > > There are languages that use 'prototype' with the common meaning. In > them you create a new object by copying an existing object which acts > its prototype. ECMAScript is not like this (whatever Wikipedia says). Can you name such a language? -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-29 10:29 +0000 |
| Message-ID | <6r2kca574ns6j9mcb13226tdm3a7jk9hta@4ax.com> |
| In reply to | #26737 |
On Wed, 28 Jan 2015 18:26:56 +0100, "Christoph M. Becker" <cmbecker69@arcor.de> wrote: >John Harris wrote: > >> On Tue, 27 Jan 2015 14:10:00 +0100, "Christoph M. Becker" >> <cmbecker69@arcor.de> wrote: >> >> >> <snip> >>> IMHO, the ECMAScript language is a prototypal language, which allows to >>> emulate class-based object models. >> <snip> >> >> As you've probably realised, my opinion differs. I think that using >> the word 'prototype' in ECMAScript was unfortunate as it's not being >> used with the common meaning. >> >> There are languages that use 'prototype' with the common meaning. In >> them you create a new object by copying an existing object which acts >> its prototype. ECMAScript is not like this (whatever Wikipedia says). > >Can you name such a language? Self : <http://en.wikipedia.org/wiki/Self_%28programming_language%29> John
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-31 00:37 +0100 |
| Message-ID | <mah4jl$rav$1@solani.org> |
| In reply to | #26743 |
John Harris wrote: > On Wed, 28 Jan 2015 18:26:56 +0100, "Christoph M. Becker" > <cmbecker69@arcor.de> wrote: > >> John Harris wrote: >> >>> On Tue, 27 Jan 2015 14:10:00 +0100, "Christoph M. Becker" >>> <cmbecker69@arcor.de> wrote: >>> >>>> IMHO, the ECMAScript language is a prototypal language, which allows to >>>> emulate class-based object models. >>> >>> As you've probably realised, my opinion differs. I think that using >>> the word 'prototype' in ECMAScript was unfortunate as it's not being >>> used with the common meaning. >>> >>> There are languages that use 'prototype' with the common meaning. In >>> them you create a new object by copying an existing object which acts >>> its prototype. ECMAScript is not like this (whatever Wikipedia says). >> >> Can you name such a language? > > Self : <http://en.wikipedia.org/wiki/Self_%28programming_language%29> Indeed, the Wikipedia article about "Prototype-based programming"[1] is somewhat misleading in that it suggests that Self links to prototype objects, whereas the `copy` message makes a copy (i.e. clones the prototype object). However, the only conceptional difference I can see between "delegation" and "concatenation" (to use the terms in the Wikipedia article), is that the former allows to change behavior and state of an object after its construction by changing its prototype, while the latter does not. So the former would be a conceptional superset of the latter, and therefore would allow prototypal programming as well. On the other hand, if one defines prototypal programming as the ability to create new objects by cloning existing ones, ECMAScript also fits well to this definition. Anyhow, actually I understand (though not necessarily acknowledge) your claim "that using the word 'prototype' in ECMAScript was unfortunate as it's not being used with the common meaning", but we're living in a world where words may change their meaning over time[2] -- and this might be such a case. [1] <http://en.wikipedia.org/wiki/Prototype-based_programming> [2] <http://www.mirror.co.uk/news/uk-news/words-literally-changed-meaning-through-2173079> -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2015-01-28 13:30 -0800 |
| Message-ID | <e78edff5-6452-4c13-b6e8-28e57c5b1884@googlegroups.com> |
| In reply to | #26735 |
On Wednesday, January 28, 2015 at 9:50:38 AM UTC-6, John Harris wrote: > There are languages that use 'prototype' with the common meaning. In > them you create a new object by copying an existing object which acts > its prototype. ECMAScript is not like this (whatever Wikipedia says). Since I can probably count the number of prototypical languages on one hand, I don't know what "common meaning" refers to...
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-01-28 22:40 +0100 |
| Message-ID | <XnsA430E6AAAC6F2eejj99@194.109.133.246> |
| In reply to | #26738 |
"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 28 jan 2015 in comp.lang.javascript: > On Wednesday, January 28, 2015 at 9:50:38 AM UTC-6, John Harris wrote: > >> There are languages that use 'prototype' with the common meaning. In >> them you create a new object by copying an existing object which acts >> its prototype. ECMAScript is not like this (whatever Wikipedia says). > > Since I can probably count the number of prototypical languages on one > hand, I don't know what "common meaning" refers to... Don't forget to count the dialects. A shprakh iz a dialekt mit an armey un flot. https://en.wikipedia.org/wiki/A_language_is_a_dialect_with_an_army_and_navy https://yi.wikipedia.org/wiki/%D7%90_%D7%A9%D7%A4%D7%A8%D7%90%D7%9A_%D7%90% D7%99%D7%96_%D7%90_%D7%93%D7%99%D7%90%D7%9C%D7%A2%D7%A7%D7%98_%D7%9E%D7%99% D7%98_%D7%90%D7%9F_%D7%90%D7%A8%D7%9E%D7%99%D7%99_%D7%90%D7%95%D7%9F_%D7%90 _%D7%A4%D7%9C%D7%90%D7%98 -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-29 10:32 +0000 |
| Message-ID | <dv2kca56rb26eidlfkq2l1cl5u210lman8@4ax.com> |
| In reply to | #26739 |
On Wed, 28 Jan 2015 22:40:31 +0100, "Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote: <snip> >https://yi.wikipedia.org/wiki/%D7%90_%D7%A9%D7%A4%D7%A8%D7%90%D7%9A_%D7%90% >D7%99%D7%96_%D7%90_%D7%93%D7%99%D7%90%D7%9C%D7%A2%D7%A7%D7%98_%D7%9E%D7%99% >D7%98_%D7%90%D7%9F_%D7%90%D7%A8%D7%9E%D7%99%D7%99_%D7%90%D7%95%D7%9F_%D7%90 >_%D7%A4%D7%9C%D7%90%D7%98 I didn't know my browser could display right to left writing. It kept looking upside down. John
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-29 10:23 +0000 |
| Message-ID | <hf2kca9qdsjcjk1qiabn7eqb489j6oiala@4ax.com> |
| In reply to | #26738 |
On Wed, 28 Jan 2015 13:30:05 -0800 (PST), "Michael Haufe (TNO)" <tno@thenewobjective.com> wrote: >On Wednesday, January 28, 2015 at 9:50:38 AM UTC-6, John Harris wrote: > >> There are languages that use 'prototype' with the common meaning. In >> them you create a new object by copying an existing object which acts >> its prototype. ECMAScript is not like this (whatever Wikipedia says). > >Since I can probably count the number of prototypical languages on one hand, I don't know what "common meaning" refers to... Common as in dictionary meaning; common as in product development and mechanical engineering. John
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-29 11:04 +0000 |
| Message-ID | <ts4kca1lnrgb4ons9aup3ujdj9epb328pq@4ax.com> |
| In reply to | #26731 |
On Tue, 27 Jan 2015 14:10:00 +0100, "Christoph M. Becker" <cmbecker69@arcor.de> wrote: >John Harris wrote: > >> On Sat, 24 Jan 2015 15:35:32 -0800 (PST), Scott Sauyet >> <scott.sauyet@gmail.com> wrote: >> >>> I tend to think of inheritance as a static, compile-time feature. Because >>> prototype delegation is a dynamic, run-time feature, I prefer to separate >>> them entirely. >> >> Do you often alter a prototype chain that's in use ? >> >> How does the programmer know what to expect when accessing these >> objects ? > >Interesting questions for sure. However, earlier in this thread[1] you, >John, claimed: > >| I don't think prototype chains make the ECMAScript language(s) a >| prototypal language (you don't say that, but others do). And calling >| it delegation-based prototyping confuses and obscures what's really >| going on. > >IMHO, the ECMAScript language is a prototypal language, which allows to >emulate class-based object models. Further thoughts : First, objects don't exactly have "prototypes" - they have a data structure that is a linked list of objects, the 'prototype chain'. Is this really prototypal? Second, the linked list can be of zero length - an object's internal [[prototype]] property can be null. Is such an object really prototypal? John
[toc] | [prev] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2015-01-26 08:21 -0800 |
| Message-ID | <aacdefe9-ed74-4c98-bdcc-40de7540c11f@googlegroups.com> |
| In reply to | #26695 |
On Saturday, January 24, 2015 at 5:35:40 PM UTC-6, Scott Sauyet wrote: > I tend to think of inheritance as a static, compile-time feature. Because > prototype delegation is a dynamic, run-time feature, I prefer to separate > them entirely. Do you have a justification for thinking such? Are you mentally separating implementation inheritance from interface inheritance? I assume you like the the latter and are indifferent to the former.
[toc] | [prev] | [next] | [standalone]
| From | Scott Sauyet <scott.sauyet@gmail.com> |
|---|---|
| Date | 2015-01-26 11:10 -0800 |
| Message-ID | <4d5cd217-84f1-4d59-b6cb-86b35343e578@googlegroups.com> |
| In reply to | #26706 |
Michael Haufe (TNO) wrote: > Scott Sauyet wrote: > >> I tend to think of inheritance as a static, compile-time feature. >> Because prototype delegation is a dynamic, run-time feature, I >> prefer to separate them entirely. > > Do you have a justification for thinking such? Not in particular. This is just a long-standing distinction I've had. But there is some backup in the Wikipedia article on delegation [1]: | Delegation has the advantage that it can take place at run-time | and affect only a subset of entities of some type and can even be | removed at run-time. Inheritance on the other hand typically | targets the type rather than the instances and is restricted to | compile time. > Are you mentally separating implementation inheritance from > interface inheritance? I do so as a matter of course. I'm not sure how important that is to these discussions. I think in Javascript, the notions of type so important in statically typed languages mostly fades into incomprehensibility. > I assume you like the the latter and are indifferent to the > former. Not quite. I simply have little use for the general notion of inheritance when dealing with really dynamic types. If I were working in Haskell, I'd have quite different notions. [1]: http://en.wikipedia.org/wiki/Delegation_(programming)#Language_feature -- Scott
[toc] | [prev] | [next] | [standalone]
| From | Scott Sauyet <scott.sauyet@gmail.com> |
|---|---|
| Date | 2015-01-22 06:36 -0800 |
| Message-ID | <d7b81b7b-e5e6-44ff-9f28-c417dde65bef@googlegroups.com> |
| In reply to | #26645 |
John Harris wrote: > Scott Sauyet wrote: >>> It might even dissuade people from calling ECMAScript a prototypal >>> language, which it clearly isn't. (Evidence : In a prototypal language >>> new objects are created by cloning existing prototype objects. >>> ECMAScript constructors do not clone.) >> >> You are confusing the specific (concatenative prototyping) with the >> general (prototyping). Javascript uses delegation-based prototyping >> instead. This is no less a form of prototyping than the concatenative >> one. > > C++ uses data structures that do the same job as prototype chains but > can't be modified by the program. C++ isn't called a prototypal > language. > > A C++ object uses the same function code for it's derived methods as > used by objects of the ancestor classes. C++ isn't said to use > delegation-based prototyping. > > I don't think prototype chains make the ECMAScript language(s) a > prototypal language (you don't say that, but others do). I hadn't said that precisely, but I do say that ES languages are prototypal languages. > And calling > it delegation-based prototyping confuses and obscures what's really > going on. In fact, I believe it's quite descriptive. It's also the commonly- understood term for this style of property access. > PS Please feel free to disagree without invective. I very rarely resort to invective on USENET. But you should realize that such an invitation is more likely to provoke than prevent such invective. -- Scott
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2015-01-06 17:34 +0000 |
| Message-ID | <060120151734221023%timstreater@greenbee.net> |
| In reply to | #26467 |
In article <qj1oaahmnp3r6j45b27sm5ujsfhqu4igv6@4ax.com>, John Harris
<niam@jghnorth.org.uk.invalid> wrote:
>On Tue, 06 Jan 2015 01:40:16 +0100, Thomas 'PointedEars' Lahn
><PointedEars@web.de> wrote:
>
>>Tony Johansson wrote:
>>
>>> The code at the end works but I have a question.
>>> When I have this code construction with prototype I can call the getFoo in
>>> this way var poo = f.getFoo(); // "bar"
>>> P.prototype.getFoo = function ()
>>> {
>>
>>I recommend to put the opening brace of a function expression on the same
>>line as the „function‰ keyword in order to tell function declarations and
>>function expressions apart more easily.
>
>And I recommend that you don't change, though a smaller indent
>wouldn't hurt. Having the curly brackets lined up makes it easier to
>see where the code body begins and ends, especially when the body
>contains inner function definitions.
Agree 100%. I see that PointyHead has given his opinion is his usual
sneering way; he may safely be ignored.
--
"... you must remember that if you're trying to propagate a creed of
poverty, gentleness and tolerance, you need a very rich, powerful,
authoritarian organisation to do it." - Vice-Pope Eric
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-06 19:03 +0100 |
| Message-ID | <m8h81k$p88$1@solani.org> |
| In reply to | #26469 |
Tim Streater wrote:
> In article <qj1oaahmnp3r6j45b27sm5ujsfhqu4igv6@4ax.com>, John Harris
> <niam@jghnorth.org.uk.invalid> wrote:
>
>> On Tue, 06 Jan 2015 01:40:16 +0100, Thomas 'PointedEars' Lahn
>> <PointedEars@web.de> wrote:
>>
>>> Tony Johansson wrote:
>>>
>>>> The code at the end works but I have a question.
>>>> When I have this code construction with prototype I can call the
>>>> getFoo in
>>>> this way var poo = f.getFoo(); // "bar"
>>>> P.prototype.getFoo = function ()
>>>> {
>>>
>>> I recommend to put the opening brace of a function expression on the
>>> same line as the „function‰ keyword in order to tell function
>>> declarations and function expressions apart more easily.
>>
>> And I recommend that you don't change, though a smaller indent
>> wouldn't hurt. Having the curly brackets lined up makes it easier to
>> see where the code body begins and ends, especially when the body
>> contains inner function definitions.
>
> Agree 100%. I see that PointyHead has given his opinion is his usual
> sneering way; he may safely be ignored.
Thomas '_Pointed Ears_', being aware of the difference between a
function declaration and a function expression, advanced a *sound*
*argument* -- I don't see how this can be reasonably called "in a
sneering way". BTW: because of this difference, some programmers even
avoid function declarations at all.
John's argument might be regarded secondary (if not invalid) nowadays.
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-01-07 15:07 +0000 |
| Message-ID | <vsiqaaha4ne28chagor402ccjpvvifn9dn@4ax.com> |
| In reply to | #26470 |
On Tue, 06 Jan 2015 19:03:33 +0100, "Christoph M. Becker" <cmbecker69@arcor.de> wrote: <snip> >Thomas '_Pointed Ears_', being aware of the difference between a >function declaration and a function expression, advanced a *sound* >*argument* -- I don't see how this can be reasonably called "in a >sneering way". BTW: because of this difference, some programmers even >avoid function declarations at all. Someone who knows a little bit about ECMAScript would know that " = function " is absolutely certain to indicate a function expression. A short comment could be added if thought to be useful. >John's argument might be regarded secondary (if not invalid) nowadays. It's still primary. Seeing where function definitions start and finish, quickly, is vital to maintenance programmers. John
[toc] | [prev] | [next] | [standalone]
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
|---|---|
| Date | 2015-01-07 16:41 +0100 |
| Message-ID | <m8jk3c$fhh$1@solani.org> |
| In reply to | #26481 |
John Harris wrote:
> On Tue, 06 Jan 2015 19:03:33 +0100, "Christoph M. Becker"
> <cmbecker69@arcor.de> wrote:
>
>> John's argument might be regarded secondary (if not invalid) nowadays.
>
> It's still primary. Seeing where function definitions start and
> finish, quickly, is vital to maintenance programmers.
ACK. However, many contemporary editors are able to display vertical
lines joining the starting and ending line of a "block" ("indentation
guides"), what is IMO even clearer than aligned braces. Furthermore
there is code folding and "jump to matching brace" available even in non
graphical editors (e.g. vim).
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-01-07 17:22 +0100 |
| Message-ID | <1676759.bbBSSFFLiy@PointedEars.de> |
| In reply to | #26483 |
Christoph M. Becker wrote:
> John Harris wrote:
>> "Christoph M. Becker" wrote:
>>> John's argument might be regarded secondary (if not invalid) nowadays.
>>
>> It's still primary. Seeing where function definitions start and
>> finish, quickly, is vital to maintenance programmers.
>
> ACK. However, many contemporary editors are able to display vertical
> lines joining the starting and ending line of a "block" ("indentation
> guides"), what is IMO even clearer than aligned braces. Furthermore
> there is code folding and "jump to matching brace" available even in non
> graphical editors (e.g. vim).
Indeed. Eclipse JSDT, for example, has had all of that for a while now
(vertical indent guides come with LiClipse [1]). But I recently discovered
the very useful “%” input in Vim; with the “matchit” add-on, it even works
with start and end tags.
But ISTM that John still has not realized that I did _not_ recommend to
write *all* opening braces of functions on the same line as the “function”
keyword, but only those of function *expressions*; and that indentation does
not enter into it (you can and should indent the function body with either
form). It is because, as is obvious from the above, he has not realized yet
that there are (at least) two ways to “define” a function in ECMAScript, of
which one includes a *declaration*.
______
[1] <http://pydev.blogspot.ch/2014/11/vertical-indent-guides-pydev-390.html>
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web