[Openmcl-devel] initforms in objc classes ?

Didier Verna didier at lrde.epita.fr
Thu Jan 31 02:08:54 PST 2008


       Hello again,

I can't figure out why my initforms don't seem to work in objc classes
(I saw some examples in the ocoa-ide directory so I assume it should
work). Suppose for instance that I have this class:

(defclass base-node (ns:ns-object)
  ((title :foreign-type :id
    :accessor title
      :initform #@"Untitled base node")
   (icon :foreign-type :id
    :accessor icon)
   (url-string :foreign-type :id
          :accessor url-string)
   (children :foreign-type :id
        :reader children ;; custom writer (see below)
             :initform (#/array ns:ns-array))
   (leafp :reader leafp ;; custom writer (see below)
     :initarg :leafp
       :initform nil))
  (:metaclass ns:+ns-object))

If I inspect an object created with (make-instance 'base-node) in Slime,
I get this:

#<BASE-NODE  #x30004211F95D>
--------------------
Nil = #0=#<BASE-NODE <BaseNode: 0x14abe800> (#x14ABE800)>
Class:  = #<OBJC:OBJC-CLASS BASE-NODE (#x14AAF1D0)>
Wrapper:  = #<CLASS-WRAPPER  #x3000420F6F2D>
Instance Slots = NIL
Leafp = NIL
Isa = #<OBJC:OBJC-CLASS BASE-NODE (#x14AAF1D0)>
Title = #<A Null Foreign Pointer>
Icon = #<A Null Foreign Pointer>
Url-String = #<A Null Foreign Pointer>
Children = #<A Null Foreign Pointer>

Underlying UVECTOR


in which you can see that the title and children slots are NULL. For the
title slot, I also tried (#/initWithString #@"bla") or just
(#/init ns:ns-string) in vain.


Please forgive me if this is too trivial; I'm quite new both to Cocoa
and the bridge... (and http://openmcl.clozure.com/Doc/index.html seems
to be down right now ;-)

Thank you !

-- 
Resistance is futile. You will be jazzimilated.

Didier Verna, didier at lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bicêtre, France   Fax.+33 (0)1 53 14 59 22  didier at xemacs.org



More information about the Openmcl-devel mailing list