mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a65f7e2ce5
commit
213e0cb870
17
README.md
17
README.md
@ -1,24 +1,20 @@
|
|||||||
# object.js
|
# object.js
|
||||||
|
|
||||||
_object.js_ provides a meta-constructor and a set of tools and utilities
|
_object.js_ is a set of tools and abstractions to create and manage
|
||||||
to aid in object/instance construction and implementing dynamic data and
|
constructors, objects and prototype chains in idiomatic JavaScript.
|
||||||
functionality inheritance within the established JavaScript prototypical
|
|
||||||
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:
|
||||||
- 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 literals. 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,
|
||||||
|
- Produces fully introspectable constructors/instances,
|
||||||
|
- Does not try to emulate constructs foreign JavaScript (i.e. classes),
|
||||||
- Granular 2-stage instance construction and initialization (a-la
|
- Granular 2-stage instance construction and initialization (a-la
|
||||||
_Python's_ `.__new__(..)` and `.__init__(..)` methods),
|
_Python's_ `.__new__(..)` 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_
|
|
||||||
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 JavaScript objects,
|
- all input components are reusable JavaScript objects,
|
||||||
@ -28,7 +24,6 @@ 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
|
Note that the produced constructors and objects are functionally
|
||||||
identical (almost) to the ones produced via ES6 classes and are
|
identical (almost) to the ones produced via ES6 classes and are
|
||||||
interchangeable with them.
|
interchangeable with them.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user