View · Search · Index
No registered users in community xowiki
in last 10 minutes

AW: Re: [Xotcl] Using instforward to wrap other packages

From: <mail_at_xdobry.de>
Date: Fri, 24 Feb 2006 08:40:13 +0100

Hi!

Learnable lazy wrapper per unknown mechanism.
Should one do such magic thinks?

package require XOTcl
namespace import ::xotcl::*
package require struct::queue

Class Queue -parameter {{queue [self]::queue}}

Queue instproc init {} {
    ::struct::queue [my queue]
}
Queue instproc destroy {} {
   [self]::queue destroy
   next
}
Queue instproc unknown {args} {
   # some debbug
   puts "learning [lindex $args 0]"
   Queue instforward [lindex $args 0] {%my queue} %proc
   # maybe learn only if that calls success
   eval [self]::queue $args
}

Testing

(bin) 31 % Queue create q1
::q1
(bin) 32 % q1 put 32
learning put
(bin) 33 % q1 put 43
(bin) 34 % q1 get
learning get
32
(bin) 35 % q1 get
43
(bin) 35 %

Artur