newClass(A,B,x)
newClass(A,x)
If x is a basic list or sequence, then BasicList should be an ancestor of A and B should be Nothing. If x is a hash table, then HashTable should be an ancestor of A.
If the class (and parent) of x are already equal to A (and B, respectively), then copying of the elements of x is not required, and is not done.
If x is mutable, and instances of class A are also mutable, then copying of the elements of x is not required, and is not done.
If x is not a hash table, basic list, or sequence, then its class will be set to A internally, essentially by wrapping it in a special kind of object designed solely to indicate the new class. The new class A must be a specialization of the class of x. The parent cannot be reset this way. Not all of the internal code of Macaulay2 is ready to recognize such wrapped objects, which are part of a new feature, except for the code that handles functions.
|
|
|
|
|
The difference between new A of B from x and newClass(A,B,x) is that the methods installed for new are not used.
|
|
|
The object newClass is a compiled function.