|
From: Damon C. <da...@tc...> - 2005-11-10 15:05:08
|
> Why not just make [snit::validateOption] public and
> use [... -validatemethod [list snit::validateOption $type]]?
Because that annoys me. 0-] And, -validatemethod specifies the name
of a method internal to the class that will handle the validation
thereby forcing me to create a method in every class to validate.
This is what most people are already doing, and it's what I don't want
to do.
>> The types I've defined are:
>>
>> boolean
>> color
>> enum
>> int
>> nullboolean (can be boolean or null)
> ^^^^^^^^^^^
>
> This one is a warning sign -- I can envision needing
> 'nullint', 'nullcolor', and 'nullpadding' too (e.g.,
> Tile-based megawidgets would probably want to allow
> NULL values for many options); which would either lead
> to a proliferation of option types, or a new "-allownulls"
> option.
Agreed. This was a carryover from BWidget. I think it should just be:
option -foo -validtype {boolean 1} ; ## The 1 says that nulls are allowed.
option -bar -validtype {int 0} ; ## The 0 says nulls are not allowed.
0 would be the default if not specified.
> I think making 'snit::validateOption' public (and adding
> any new validation-related options to *that* routine)
> would be a better factoring.
Well, either way we need to add an argument to options. It's either
gonna' be something like -validateproc (instead of -validatemethod) or
-validtype (which I think is cleaner). Or, we can modify
-validatemethod to take a proc name, but then it's not really a
validate METHOD. And, how would you distinguish between a method name
and a proc name? Fully-qualified name?
D
|