[Openmcl-devel] initarg for :foreign-type slot ignored
gb at clozure.com
Mon Jan 28 14:49:24 CST 2013
Sorry for not responding (or looking at or thinking about this) earlier.
The SHARED-INITIALIZE method for OBJC:OBJC-OBJECT was intentionally
ignoring foreign slot definitions. It can't meaningfully use initforms
to initialize a foreign slot (what would it mean for a foreign slot
to not be SLOT-BOUNDP ?) but can't think of a reason not to process
initargs in essentially the same was that the STANDARD-OBJECT method
This should be fixed in the trunk as of r15617.
On Fri, 18 Jan 2013, Paul Krueger wrote:
> Is this expected behavior or another oversight?
> Welcome to Clozure Common Lisp Version 1.9-dev-r15567M-trunk (DarwinX8664)!
> ? (defclass test (ns:ns-object)
> ((s1 :foreign-type :id
> :accessor s1
> :initarg :s1)
> (s2 :accessor s2
> :initarg :s2))
> (:metaclass ns:+ns-object))
> #<OBJC:OBJC-CLASS TEST (#x26F695E0)>
> ? (setf obj (make-instance 'ns:ns-view))
> #<NS-VIEW <NSView: 0x26f2a240> (#x26F2A240)>
> ? (setf t1 (make-instance 'test :s1 obj :s2 3))
> #<TEST <Test: 0x237f36e0> (#x237F36E0)>
> ? (s1 t1)
> #<A Null Foreign Pointer> <== initarg for :foreign-type slot ignored
> ? (s2 t1)
> As before, I can create an initialize-instance :after method that takes the keyword value and explicitly sets
> the slot value, so there is a work-around.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel