Contents (package MULK.OBJECTIVE-CL)

Standard Generic Function OBJC-EQL


Test whether two references point to the same object.


objc-eql x y

Arguments and Values:

x --- an object.

y --- an object.

Returns: the-same-p --- a generalized boolean.


If at least one of the objects x and y is not an Objective-C instance wrapper, objc-eql behaves the same as eql.

For Objective-C instance wrappers, objc-eql compares the pointers represented by these instances. If the pointers are pointer-eq (see the CFFI manual for details), objc-eql returns true. Otherwise, it returns false.


(objc-eql (find-objc-class 'ns-string)  
          (find-objc-class 'ns-string))  
 ;=> T  
(objc-eql (find-objc-class 'ns-string)  
          (find-objc-class 'ns-object))  
 ;=> NIL  
(setq greeting1 (invoke (find-objc-class 'ns-string)  
                        :string-with-u-t-f-8-string "Mulk."))  
 ;=> #<GSCBufferString `Mulk.' {8109A38}>  
(setq greeting2 (invoke (find-objc-class 'ns-string)  
                        :string-with-u-t-f-8-string "Mulk."))  
 ;=> #<GSCBufferString `Mulk.' {8109DB0}>  
(objc-equal greeting1 greeting2)  
 ;=> T  
(objc-eql greeting1 greeting2)  
 ;=> NIL  
(objc-equal greeting1 greeting1)  
 ;=> T  
(objc-eql greeting1 greeting1)  
 ;=> T  

See Also: