On 5 Aug 2010, at 12:11, Gustaf Neumann wrote:
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.
Sorry, yes. I need to check still what 2.0 does with:
Car c1 $a
where $a starts with a dash.
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.
I think these are fine. Errors when given a parameter of the wrong type are totally expected, and cannot be abused to execute code with bad values.