![]() | ![]() | ![]() | make-duplicate-instance-changing-class | ![]() |
| instance
&rest initargs&key &allow-other-keys | [Generic Function] |
Purpose
Create a duplicate instance of instance, changing its
class to new-class in the process.
Method signatures
( instance standard-object)
( new-class class)
unduplicated-slot-names
&rest initargs
|
( instance standard-object)
( new-class standard-space-class)
unduplicated-slot-names
&rest initargs
|
( instance standard-object)
( new-class standard-unit-class)
unduplicated-slot-names
&rest initargs
|
( instance standard-object)
( new-class symbol)
unduplicated-slot-names
&rest initargs
|
:around
( instance standard-unit-instance)
( new-class standard-unit-class)
unduplicated-slot-names
&rest initargs
|
Package :gbbopen-tools
(re-exported by :gbbopen
Module :gbbopen-tools
(the unit-instance and
space-instance methods are added by :gbbopen-core
Arguments and values
instance | A standard-object instance
| |
new-class | A class designator | |
unduplicated-slot-names | A list of slot names | |
initargs | An initialization argument list | |
new-instance | A standard-object instance
| |
slots | A proper list of slot objects |
Returns
Two values: the (newly created) duplicate instance and a
list of the slots that were duplicated or explicitly initialized.
Events
When a unit instance is duplicated, events are signaled in the
following sequence:
nonlink-slot-updated-event
link-event
link-event
instance-added-to-space-instance-event
instance-created-event
is signaled.
Errors
Use of an initialization argument that has not been declared as valid.
Description
Slot initialization during instance duplication behaves as follows, regardless
of whether the slots are local or shared:
:initform
When creating (duplicating) a new unit instance, specifying a
:instance-name
:use-global-instance-name-counter
nil
or was not specified for the unit class) or the global
instance-name counter value (if the
:use-global-instance-name-counter
A :space-instances
See also
change-class
delete-instance
describe-instance
initial-class-instance-number
instance-name-of
make-duplicate-instance
make-instance
make-space-instance
next-class-instance-number
unduplicated-slot-names
Examples
Create some simple duplicate instances:
> (define-class foo () ((a :initform 1) (b :initform 2))) #<standard-class foo> > (define-unit-class bar () ((a :initform 1) (b :initform 2))) #<standard-class bar> > (defparameter *x* (make-instance 'foo :a 11 :b 12)) *x* > :ds *x* #<foo #x110fe6ea> is an instance of #<standard-class foo>: The following slots have :instance allocation: a 11 b 12 > :ds (make-duplicate-instance-changing-class *x* 'foo nil :a -1) #<foo #x110ff93a> is an instance of #<standard-class foo>: The following slots have :instance allocation: a -1 b 12 > :ds (make-duplicate-instance-changing-class *x* 'bar nil :b 2) #<bar #x11100032> is an instance of #<standard-unit-class bar>: The following slots have :instance allocation: a 11 b 2 > :ds (make-duplicate-instance-changing-class *x* 'bar '(b) :a -1) #<bar #x11104542> is an instance of #<standard-unit-class bar>: The following slots have :instance allocation: a -1 b 2 > :ds (make-duplicate-instance-changing-class *x* 'bar '(b)) #<bar #x11108c82> is an instance of #<standard-unit-class foo>: The following slots have :instance allocation: a 11 b 2 > (make-duplicate-instance-changing-class *x* 'bar nil) #<bar @ #x1110a0e2> (#<standard-effective-slot-definition b> #<standard-effective-slot-definition a>) >
Create a duplicate of the hyp
419
unit instance as a
probable-hyp
> (make-duplicate-instance-changing-class (find-instance-by-name 19 'hyp) 'possible-hyp nil) #<possible-hyp 681 (1835 4791) 0.85 [5..35]> >
The GBBopen Project
![]() | ![]() | ![]() | make-duplicate-instance-changing-class | ![]() |