mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
56318db409
commit
7e294f8c95
27
README.md
27
README.md
@ -8,28 +8,33 @@ object model and interfaces.
|
||||
|
||||
This is an alternative to the ES6 `class` syntax in JavaScript and provides
|
||||
several advantages:
|
||||
- Simple way to define instance and "class" (constructor) methods,
|
||||
properties and attributes,
|
||||
- Simple way to define instance and constructor methods, properties and
|
||||
attributes,
|
||||
- Uniform and minimalistic definition syntax based on basic JavaScript
|
||||
object syntax, no special cases, special syntax or _"the same but slightly
|
||||
different"_ ways to do things,
|
||||
- _Transparently_ based on JavaScript's prototypical inheritance model,
|
||||
- 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_
|
||||
`.__call__(..)`)
|
||||
- produces fully introspectable constructors/instances, i.e. no direct
|
||||
way to define "private" attributes or methods.
|
||||
`.__call__(..)`),
|
||||
- Produces fully introspectable constructors/instances, i.e. no _direct_
|
||||
way to define "private" attributes or methods,
|
||||
- Does not try to emulate constructs not present in the language (classes),
|
||||
- Less restrictive:
|
||||
- `new` is optional
|
||||
- all input components are reusable
|
||||
- no artificial restrictions
|
||||
- `new` is optional,
|
||||
- all input components are reusable,
|
||||
- no artificial restrictions.
|
||||
|
||||
Disadvantages compared to the `class` syntax:
|
||||
- No _syntactic sugar_
|
||||
- Slightly more complicated calling of `parent` (_super_) methods
|
||||
- No _syntactic sugar_,
|
||||
- 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:
|
||||
<table border="0">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user