[Xotcl] Very severe limitation in XOTcl

Kristoffer Lawson setok at scred.com
Wed Aug 4 02:42:56 CEST 2010

This is really bad news, guys...

% package require XOTcl
% namespace import xotcl::*
% Class Foo
% Foo instproc init {a} {puts $a}
% set a "-test"
% Foo new $a
::xotcl::__#0: unable to dispatch method 'test' during '::xotcl::__#0 test'

In other words: it is totally impossible to pass in a value beginning with "-" to an XOTcl constructor using the normal instantiation methods. This means absolutely anything where you don't know what is going to be passed beforehand is at a huge risk, as obviously any text can thus call random methods. That is without doing the whole process manually (ie. alloc, init). And you'd have to do it almost always, to be safe.

Even if the usual Tcl "--" style was used, I still think that would not be enough, as practically speaking you'd have to use that every single time, making the code horribly ugly. It's just about acceptable for [switch], but not for a constructor, where people fully expect to be able to pass in any variable...

Please tell me I'm dreaming (it's almost 4am here)

Kristoffer Lawson, Co-Founder, Scred // http://www.scred.com/

More information about the Xotcl mailing list