cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-05-06 13:45:54 +03:00
parent 56318db409
commit 7e294f8c95

View File

@ -8,28 +8,33 @@ object model and interfaces.
This is an alternative to the ES6 `class` syntax in JavaScript and provides This is an alternative to the ES6 `class` syntax in JavaScript and provides
several advantages: several advantages:
- Simple way to define instance and "class" (constructor) methods, - Simple way to define instance and constructor methods, properties and
properties and attributes, attributes,
- Uniform and minimalistic definition syntax based on basic JavaScript - Uniform and minimalistic definition syntax based on basic JavaScript
object syntax, no special cases, special syntax or _"the same but slightly object syntax, no special cases, special syntax or _"the same but slightly
different"_ ways to do things, different"_ ways to do things,
- _Transparently_ based on JavaScript's prototypical inheritance model, - _Transparently_ based on JavaScript's prototypical inheritance model,
- Granular instance construction (a-la _Python's_ `.__new__(..)` - Granular instance construction (a-la _Python's_ `.__new__(..)`
and `.__init__(..)` methods) and `.__init__(..)` methods),
- Simple way to define callable instances (including a-la _Python's_ - Simple way to define callable instances (including a-la _Python's_
`.__call__(..)`) `.__call__(..)`),
- produces fully introspectable constructors/instances, i.e. no direct - Produces fully introspectable constructors/instances, i.e. no _direct_
way to define "private" attributes or methods. way to define "private" attributes or methods,
- Does not try to emulate constructs not present in the language (classes),
- Less restrictive: - Less restrictive:
- `new` is optional - `new` is optional,
- all input components are reusable - all input components are reusable,
- no artificial restrictions - no artificial restrictions.
Disadvantages compared to the `class` syntax: Disadvantages compared to the `class` syntax:
- No _syntactic sugar_ - No _syntactic sugar_,
- Slightly more complicated calling of `parent` (_super_) methods - Slightly more complicated calling of `parent` (_super_) methods.
Note that the produced constructors and objects are functionally
identical (almost) to the ones produced via ES6 classes and are
interchangeable with them.
Here is a basic comparison: Here is a basic comparison:
<table border="0"> <table border="0">