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
%

No Software Patents

| Home | Sitemap | A-Z