[Xotcl] Very severe limitation in XOTcl

mail at xdobry.de mail at xdobry.de
Wed Aug 4 09:08:20 CEST 2010

I found a work around according to xotcl documentation.
Foo new [list -init $a]
I had also problems with -_values by parameters.
I often write class methods to create and init instances. (Smalltalk style).
Something like:
Foo proc createInstace {a} {
    set a [Foo new]
    $a set arg1 $a
    $a initme
    return $a


Kristoffer Lawson <setok at scred.com> hat am 4. August 2010 um 02:42 geschrieben:

> This is really bad news, guys...
> % package require XOTcl
> 1.6.2
> % namespace import xotcl::*
> % Class Foo
> ::Foo
> % Foo instproc init {a} {puts $a}
> % set a "-test"
> -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/
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl

More information about the Xotcl mailing list