[Xotcl] Very severe limitation in XOTcl
Gustaf Neumann
neumann at wu-wien.ac.at
Thu Aug 5 11:11:59 CEST 2010
Am 05.08.10 10:38, schrieb Kristoffer Lawson:
> Yes, this is also true for setting a parameter:
>
> Car new -doors $amount
>
> If $amount contains a dash, it'll do a method call.
>
Well, "contains" is too strong,
"starts with a dash followed by alpha" is precise.
With XOTcl 2.0 (as now in git) the following cases work as expected
package req XOTcl 2.0; namespace import ::xotcl::*
Class Car -parameter {{doors 4}}
Car c1 -doors -2
Car c2 -doors a-b
Car c3 -doors -b
with XOTcl 0|1.*, case "c3" was leading to the problem.
With XOTcl 2.0, one would most probably use
Class Car -parameter {{doors:integer 4}}
Car c1 -doors -2
Car c2 -doors a-b
to trigger an error on "c2", or better define your own checker "posint"
Class Car -parameter {{doors:posint 4}}
to get already errors on c1.
-gustaf
More information about the Xotcl
mailing list