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


Groups > comp.lang.javascript > #17320

Re: OOP in Javascript: Class function to define "classes"

Newsgroups comp.lang.javascript
Date 2012-11-20 08:21 -0800
References (1 earlier) <fpITktE8LRqQFwbV@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <b701b1aa-a8f8-4cd9-8a22-a74330d84ec9@googlegroups.com> <vkZF17DbllqQFwd2@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD> <fb4c2285-28b7-41a6-923c-10480d33e69d@googlegroups.com> <pHPEOmBEG5qQFw$H@J.A830F0FF37FB96852AD08924D9443D28E23ED5CD>
Message-ID <6c90366f-ae74-4bfd-ad72-81f512fcf668@googlegroups.com> (permalink)
Subject Re: OOP in Javascript: Class function to define "classes"
From Luca Lazzarini <lzzluca@gmail.com>

Show all headers | View raw


Il giorno martedì 20 novembre 2012 14:19:54 UTC, John G Harris ha scritto:
> On Mon, 19 Nov 2012 at 09:37:50, in comp.lang.javascript, Luca Lazzarini
> 
> wrote:
> 
> 
> 
>   <snip>
> 
> >>>It shouldn't be a prototype, or described as one. It should be a
> 
> >>>declaration of what must be in each object. E.g A collection of data
> 
> >>>property names; a collection of method property names and their
> 
> >>>definitions; odds and ends such as super's name.
> 
> >
> 
> >Well, as i wrote, the prototypal chain is "broken" so, in the end, i
> 
> >think the Class's parameter looks like a "declaration of what must be
> 
> >in each object" and we could say "it is"... You know it is the
> 
> >prototype only checking the prototype of your class and i think it is
> 
> >really important to get members on the prototype of the class: thank to
> 
> >that, you can easily inherit your class using prototypal inheritance.
> 
> 
> 
> The prototype chain is a linked list that is searched from front to
> 
> back, stopping when the desired name is found or when falling off the
> 
> end of the list. What could be simpler?
> 
> 
> 
> Why "break" this chain?
> 
> 
> 
> 
> 
>   <snip>
> 
> >An example about Implements:
> 
> >----------------------------
> 
>   <snip>
> 
> 
> 
> Be aware that this is nothing like "implements" in Java.
> 
> 
> 
> 
> 
>   John
> 
> -- 
> 
> John Harris

Well, the idea is to break the prototypal chain only to make data properties, defined on the "class", unique. Well, to say it better: i think the idea of MooTools minds about that, is the one i said.
That means that you cannot change the a data property on the prototype of a constructor function from an instance of that function itself!

About Implements, i think you right when you say it is not the same that in Java and Implements can be a confusing name... nothing to say about it. But i think aswell it can be an interesting tool to have and Js doesn't provide this kind of tools natively.

In the end, i think your considerations make sense but from my side, i don't think it is a so wrong to use a tool like Class inside a project.

All in my modest opinion,
Luca

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OOP in Javascript: Class function to define "classes" lzzluca@gmail.com - 2012-11-17 06:25 -0800
  Re: OOP in Javascript: Class function to define "classes" John G Harris <john@nospam.demon.co.uk> - 2012-11-18 16:55 +0000
    Re: OOP in Javascript: Class function to define "classes" Luca Lazzarini <lzzluca@gmail.com> - 2012-11-18 12:28 -0800
      Re: OOP in Javascript: Class function to define "classes" John G Harris <john@nospam.demon.co.uk> - 2012-11-19 16:07 +0000
        Re: OOP in Javascript: Class function to define "classes" Luca Lazzarini <lzzluca@gmail.com> - 2012-11-19 09:37 -0800
          Re: OOP in Javascript: Class function to define "classes" John G Harris <john@nospam.demon.co.uk> - 2012-11-20 14:19 +0000
            Re: OOP in Javascript: Class function to define "classes" Luca Lazzarini <lzzluca@gmail.com> - 2012-11-20 08:21 -0800
    Re: OOP in Javascript: Class function to define "classes" Scott Sauyet <scott.sauyet@gmail.com> - 2012-11-19 19:14 -0800
      Re: OOP in Javascript: Class function to define "classes" Luca Lazzarini <lzzluca@gmail.com> - 2012-11-22 03:15 -0800

csiph-web