[top][index]
search for:

new -- new objects of various types

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 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.

The class A should be a type of type, which means that Type is an ancestor of A and of the class of A.


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.

The class A should be a type of type, which means that Type is an ancestor of A and of the class of A.


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.

The class A should be a type, which means that Type is an ancestor of the class of A.


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.

The class A should be a type, which means that Type is an ancestor of the class of A.


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 internally for installation of the initialization routines.

See also:

  • classes and types -- an overview

  • [top][index]
    search for: