validatemethod

obj validatemethod $class $key $val $body
manages that $body is invoked before configuration delivering the opportunity to raise an error if something went unexpected.

Example:

% obj validatemethod line -coords val {
  foreach c $val {
    if {![string is double -strict $c]} then {
      return -code error\
        [list $self expects for -coords only numbers\
          but received $c]!
    }
  }
}
validatemethod line -coords
%

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z