From e86758330b6b263762a1513ba5c8fa9879452dd5 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 4 May 2020 02:49:57 +0300 Subject: [PATCH] docs... Signed-off-by: Alex A. Naanou --- object.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/object.js b/object.js index 0661027..0226f63 100755 --- a/object.js +++ b/object.js @@ -508,19 +508,17 @@ function(context, constructor, ...args){ // clone it via. Object.create(..) or copy it... // NOTE: to disable .__rawinstance__(..) handling set it to false in the // class prototype... +// NOTE: it is currently not possible to mix native unrelated types, for +// example a callable array constructor will produce inconsistent +// instance objects that in general will not work as expected... +// Reflect.construct(Array, [], Function) +// or +// Reflect.construct(Function, [], Array) +// will either initialize internal/hidden state for either one or +// the other producing a semi-broken instance. +// It is however possible to mix related types as we are doing for +// callable instances (Function + Object -- a function is an object). // -// XXX BUG?: this does not make a callable array... -// X = Constructor('X', Array, function(){}) -// ...can we "mix" disibilar types in JS, if yes then how do we -// construct the instance -- which constructor do we call??? -// ..this appears not to be possible as: -// 1) Reflect.construct(Function, [], Array) -// will produce a callable object with access to all the -// array methods but none of the low-level mechanics, thus -// part of the methods will break like .push(..) -// 2) Reflect.construct(Array, [], Function) -// will produce an array instnace that looks like a function -// but is not callable... // XXX revise .toString(..) definition test... var Constructor = module.Constructor =