[Xotcl] Using instforward to wrap other packages

Gustaf Neumann neumann at wu-wien.ac.at
Thu Feb 23 18:08:54 CET 2006


For now, the best coming up my mind is:

   Class Queue -parameter {{queue [self]::queue}}
   Queue instproc init {} {
     ::struct::queue [my queue]
   }
   foreach cmd {clear get peek put unget size} {
     Queue instforward $cmd {%my queue} %proc
   }
   Queue instproc destroy {} {
     [self]::queue destroy
     next
  }

or you can try this road:

  Class Queue
   Queue instproc init {} {
     set queue [self]::queue
     ::struct::queue $queue
     my forward clear $queue %proc
     my forward get   $queue %proc
     my forward put   $queue %proc
     my forward peek  $queue %proc
     my forward unget $queue %proc
     my forward size  $queue %proc
   }
   Queue instproc destroy {} {
     [self]::queue destroy
     next
   }

guess, we have currently no shortcut to address a child of the current
instance. suggestions for making things nicer are always welcome...

-gustaf



More information about the Xotcl mailing list