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

Re: [Xotcl] NX unknown method

From: Stefan Sobernig <stefan.sobernig_at_wu.ac.at>
Date: Fri, 18 Feb 2011 12:58:54 +0100

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