updated docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-04-27 18:14:39 +03:00
parent 7c5f4884fc
commit b92af62a23

View File

@ -339,16 +339,26 @@ function(context, constructor, ...args){
// //
// //
// Init protocol: // Init protocol:
// 1) the base instance object is created // 1) raw instance is created:
// 2) if .__new__(..) is defined it is passed to it along with the // a) constructor.__rawinstance__(..) / makeRawInstance(..) called:
// constructor arguments and the return value is used as base instance. // - call .__new__(..) if defined and get return value as instance, or
// NOTE: .__new__(..) is called in the context of the constructor // - if .__call__(..) defined or prototype is a function, wrap it and
// .prototype... // use the wrapper function as instance, or
// 2) the base instance object is prepared (.__proto__ is set) // - create an empty object
// 3) if <init-func> is present, then it is called with instance as // b) instance linked to prototype chain
// context and passed the constructor arguments // set .__proto__ to constructor.prototype
// 4) if <proto>.__init__(..) is present, it is called with the instance // 2) instance is initialized:
// as context and passed the constructor arguments. // call .__init__(..) if defined
//
//
// Special methods (constructor):
// .__rawinstance__(context, ...)
//
//
// Special methods (.prototype):
// .__new__(context, ..)
// .__call__(context, ..)
// .__init__(..)
// //
// //
// //