From 61ab565afb802a8eec9d67f18b8953418748c099 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 2 May 2020 00:41:33 +0300 Subject: [PATCH] doc cleanup... Signed-off-by: Alex A. Naanou --- object.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/object.js b/object.js index 3f2696c..f73b2d5 100755 --- a/object.js +++ b/object.js @@ -1,5 +1,9 @@ /********************************************************************** * +* object.js +* +* Repo and docs: +* https://github.com/flynx/object.js * * * XXX should this extend Object??? @@ -315,6 +319,15 @@ function(root, ...objects){ // adding and instance constructor as a class method would create // unneccessary restrictions both on the "class" object and on the // instance... +// +// XXX Q: should the context (this) in .__new__(..) be _constructor or +// .prototype??? +// ... .prototype seems to be needed more often but through it we +// can't reach the actual constructor... but on the other hand we +// can (should?) always explicitly use it -- .__new__(..) is usually +// in the same scope + this makes it more reusable for chaining +// .__new__(..) calls... +// ...currently it's .prototype... var makeRawInstance = module.makeRawInstance = function(context, constructor, ...args){ @@ -356,8 +369,6 @@ function(context, constructor, ...args){ enumerable: false, }) - // there is explicitly no initialization here... - return obj } @@ -437,7 +448,7 @@ function(context, constructor, ...args){ // NOTE: raw instance creation is defined by makeRawInstance(..) so see // it for more info. // NOTE: raw instance creation can be completely overloaded by defining -// .__rawinstance__(..) on the constructor. (XXX EXPERIMENTAL) +// .__rawinstance__(..) on the constructor. // // // @@ -486,11 +497,7 @@ function(context, constructor, ...args){ // not reusable, to use the same prototype for multiple objects // clone it via. Object.create(..) or copy it... // NOTE: to disable .__rawinstance__(..) handling set it to false in the -// class prototype... (XXX EXPERIMENTAL) -// -// XXX EXPERIMENTAL: calling .__rawinstance__(..) to create an instance... -// XXX Q: should the context in .__new__(..) be _constructor or .prototype??? -// ...currently it's .prototype... +// class prototype... var Constructor = module.Constructor = // shorthand... @@ -541,7 +548,6 @@ function Constructor(name, a, b){ }) _constructor.__proto__ = cls_proto _constructor.prototype = proto - // XXX EXPERIMENTAL... // generic raw instance constructor... _constructor.__rawinstance__ instanceof Function || (_constructor.__rawinstance__ =