All Manuals > LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual > 2 Objective-C Reference

objc-object-copied Generic Function

Summary

Called when an Objective-C is copied by the NSCopying protocol.

Package

objc

Signature

objc-object-copied old-object new-object

Method signatures

objc-object-copied (old-object standard-objc-object) (new-object new-object)

Arguments
old-object, new-object
Objects of type standard-objc-object.
Description

When an Objective-C foreign object is copied by the NSCopying protocol and its class was defined by define-objc-class, the runtime system calls the generic function objc-object-copied with old-object being the associated copied object of type standard-objc-object and new-object being the associated copy. This allows the copy to be initialized with any required changes or reference counts for its slots to be adjusted.

The built-in primary method specializing old-object on standard-objc-object sets the slots of new-object to the same values as old-object, but typically :after methods are defined to handle class-specific initialization.

This function should not be called directly.

Defining a method for objc-object-copied is similar to implementing copyWithZone: in Objective-C code.

See also

standard-objc-object


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 18 Feb 2025 15:39:48