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


Groups > comp.lang.javascript > #27254

Re: Javascript classes. Please take a look at my question.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Javascript classes. Please take a look at my question.
Date Thu, 09 Apr 2015 01:31:07 +0200
Organization PointedEars Software (PES)
Lines 27
Message-ID <2436927.QxtA20KIfX@PointedEars.de> (permalink)
References <e7563f81-a11d-4d56-a61a-c0c84f966c3e@googlegroups.com> <mg456a$2sr$4@dont-email.me> <mg47u5$9q8$1@solani.org>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace solani.org 1428535991 30652 eJwNyMERACEIA8CWBEOUciQM/Zdwt8+NTaMOGERMzBMNwxDkVxd2ylXeaqXnw/oL2o2ezFX5ASGhETI= (8 Apr 2015 23:33:11 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Wed, 8 Apr 2015 23:33:11 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwFwYEBwCAIA7CXKpYi5wDO/09Y4ltLE5SL/vzxEw8yiWobU0Ee9TF1xBsv7NZdUz1phjBHJ1YPDjfD6gc2KBSU
Cancel-Lock sha1:s98IJCE0m/oDKbvyrG7rULUZmb4=
X-NNTP-Posting-Host eJwFwYEBwCAIA7CXaoFOzhGR/09YEqal+7lCHhOzyHY0nrystnfyjqEKARwN8x1V6lWT2/MHFVkQ7w==
Xref csiph.com comp.lang.javascript:27254

Show key headers only | View raw


Christoph M. Becker wrote:

> Denis McMahon wrote:
>> I haven't tested the following code, but it might return a result object
>> that either contains the results you want, garbage, or a single error
>> attribute.
> 
> <snip>
> 
>> Sorry it's not a class object, but I've never really grokked the whole
>> emulate OOP with javascript using functions as classes thing[1].
> 
> It appears that the function can be used as constructor function

No, it cannot.  It is syntactically invalid to begin with.

> and called with `new election([...])`, so all is well. ;)

It is a fundamental misconception that OOP requires classes.  You do _not_ 
emulate OOP using functions as constructors in most ECMAScript 
implementations; you *do* OOP, just a special kind of prototype-based OOP.
 
-- 
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.

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


Thread

Javascript classes. Please take a look at my question. Rahul Reddy <rahulreddy160@gmail.com> - 2015-04-08 10:44 -0700
  Re: Javascript classes. Please take a look at my question. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-04-08 22:49 +0200
  Re: Javascript classes. Please take a look at my question. Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-08 21:05 +0000
    Re: Javascript classes. Please take a look at my question. "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-04-08 23:52 +0200
      Re: Javascript classes. Please take a look at my question. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-09 01:31 +0200
        Re: Javascript classes. Please take a look at my question. "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-04-09 16:31 +0200
      Re: Javascript classes. Please take a look at my question. Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-09 01:48 +0000
  Re: Javascript classes. Please take a look at my question. John Harris <niam@jghnorth.org.uk.invalid> - 2015-04-09 09:24 +0100

csiph-web