[Xotcl] NX unknown method

Stefan Sobernig stefan.sobernig at wu.ac.at
Fri Feb 18 12:58:54 CET 2011


Victor,

>  Am I doing something wrong?

No, what you scripted is perfectly fine (by intention), you just 
revealed a collateral (in my understanding):

Right now, there is no ::nx::Object->unknown() defined, which would be 
the [next] target. Therefore, [next] does not give you what you expect. 
If you look in nx.tcl, it is simply commented out.

In the commit 
http://fisheye.openacs.org/changelog/xotcl/?cs=//xotcl/67ad561b71e208451454fc1d71e591e75e4f3a71 
changes where applied to make a scripted unknown method on the root 
class (::nx::Object) unnecessary.
however, these changes do not cover the case of refining this built-in 
unknown "method".

a quick workaround for the scope of your application is to define 
::nx::Object->unknown() at an early stage:

::nx::Object protected method unknown {m args} {
   error "[::nsf::self]: unable to dispatch method '$m'"
}

or simply signal the error in your application-level unknown:

C method unknown {m args} {
   if {$args eq "test"} {
     puts "found test";
     return
   }
   error "[::nsf::self]: unable to dispatch method '$m'"
}


for an authorative fix i would need to understand why these changes 
happened in the first place which i don't, frankly. was the intention to 
remove unknown from ::nx::Object method record entirely? i hope not ... 
but gustaf is the authority here.

//stefan


More information about the Xotcl mailing list