new

new A of b from c -- make a hash table of class A and parent b initialized from c.
new A of b -- make a hash table of class A and parent b.
new A from c -- make a new instance of class A initialized from c.
new A -- makes a new instance n of class A.


new A of b from c -- make a hash table n of class AA and parent b initialized from c.

One may use this to model the mathematical notion that x is an element of A and a subset of b. Here A and b are hash tables, and c is any expression. Let b be an instance of B, c be an instance of C, and let AA be an ancestor of A. Then use

               new AA of B from C := (A,b,c) -> ... 
to install the corresponding optional creation routine -- the value it returns will be converted so its class is A and its parent is b; this will involve copying unless the returned value is mutable and objects of class A are mutable.

If no installation routine has been installed, then c should be a hash table or a list, and it will be converted directly.


new A of b -- make a hash table of class A and parent b.

Same as above, except c is missing. Use

               new AA of B := (A,b) -> ... 
to install the initialization routine.
new A from c -- make a hash table or list n of class A initialized from c.

The same as above except b is missing. Use

               new AA from C := (A,c) -> ... 
to install the corresponding initialization routine.

Since no parent b has been provided, the value returned by the initialization routine will not have its parent reset. If there is no initialization routine the parent will be set to Nothing.


new A -- make a new instance n of class A.

Same as above, except b and c are missing. Use new AA := A -> ... to install the initialization routine.

Since no parent b has been provided, the value returned by the initialization routine will not have its parent reset. If there is no initialization routine the parent will be set to Nothing.

Note that if the of option is not used, then the class A need not consist of hash tables or lists. We are using this feature by installing a method so that new ZZ returns an integer popped from the top of the engine's stack.

The symbols NewMethod, NewOfMethod, NewFromMethod, and NewOfFromMethod are used for installation of the initialization routines.

See also classes, of, and from.


topindexpreviousupnext