I just thought I'd politely point out here that JS isn't a purely OO
language (it's even less so class-based OO - ES classes are about 90%
sugar over prototype-based inheritance\*). Also, C#, the language that
*first* had this kind of syntax, [also doesn't have this].
Constructors should be seen as *what allocates and instantiates the
instance*, not *what loads and creates the instance*, and nearly every
OO language out there assumes the former model, that of
allocation/instantiation. (C++ is one of the unusual ones that
conflates the two with its RAII.)
\* There's a few features ES classes offer that prototypes don't, with
`new.target` being the biggest one. But in general, ES classes aren't
like traditional classes - they can be easily modified, up to and
including their inheritance chain (which is downright trivial). Also,
duck typing is reified in the spec, with that being used instead of
interfaces when subclassing. Contrast this with Python, which makes it
very difficult to change inheritance chains at runtime, and Ruby,
[which has had bugs over invalid assumptions with this] (Classes
don't invalidate their method caches with `initialize_copy`).
Looking for web consulting? Or a new website?
Send me an email and we can get started.
On Mon, Feb 19, 2018 at 12:41 PM, Dimitrian Nine
> "why a static factory"
> I answered earlier:
> <<Maybe, but i think it question similiar to "factory vs class">>
> Yes, you can, but for me more easy to work with classes.
> And i just want to extend the functionality for work with async - that all.
> es-discuss mailing list
es-discuss mailing list