Index: doc/tutorial2.html =================================================================== diff -u -r210eab6d9149846d5d6a6a8e0fa74e232ca5b6de -r9a128ffc80f0c429d885af38e92c50b253cdb9e8 --- doc/tutorial2.html (.../tutorial2.html) (revision 210eab6d9149846d5d6a6a8e0fa74e232ca5b6de) +++ doc/tutorial2.html (.../tutorial2.html) (revision 9a128ffc80f0c429d885af38e92c50b253cdb9e8) @@ -3880,6 +3880,8 @@ instance variable in the object.
+**** NOCHECK is removed **** +In general, checking of variables can be turned off globally by
Index: generic/predefined.h =================================================================== diff -u -r4a91216d0624226fb9a64de97feccc84cc79df79 -r9a128ffc80f0c429d885af38e92c50b253cdb9e8 --- generic/predefined.h (.../predefined.h) (revision 4a91216d0624226fb9a64de97feccc84cc79df79) +++ generic/predefined.h (.../predefined.h) (revision 9a128ffc80f0c429d885af38e92c50b253cdb9e8) @@ -376,32 +376,6 @@ "::xotcl::setinstvar $obj $var [$obj eval $cmd]}\n" "::xotcl::Attribute method __value_changed_cmd {obj cmd var sub op} {\n" "eval $cmd}\n" -"::xotcl::Attribute method check_single_value { {-keep_old_value:boolean true} value predicate type obj var} {\n" -"if {![expr $predicate]} {\n" -"if {[$obj exists __oldvalue($var)]} {\n" -"::xotcl::setinstvar $obj $var [::xotcl::setinstvar $obj __oldvalue($var)]} else {\n" -"$obj unset -nocomplain $var}\n" -"error \"'$value' is not of type $type\"}\n" -"if {$keep_old_value} {::xotcl::setinstvar $obj __oldvalue($var) $value}}\n" -"::xotcl::Attribute method check_multiple_values {values predicate type obj var} {\n" -"foreach value $values {\n" -":check_single_value -keep_old_value false $value $predicate $type $obj $var}\n" -"::xotcl::setinstvar $obj __oldvalue($var) $value}\n" -"::xotcl::Attribute method mk_type_checker {} {\n" -"puts stderr \"[self] [self proc]\"\n" -"set __initcmd \"\"\n" -"if {[:exists type]} {\n" -"if {[::xotcl::is ${:type} class]} {\n" -"set predicate [subst -nocommands {\n" -"[::xotcl::is \\$value object] && [::xotcl::is \\$value type ${:type}]}]} elseif {[llength ${:type}]>1} {\n" -"set predicate \"\\[${:type} \\$value\\]\"} else {\n" -"set predicate \"\\[:type=${:type} ${:name} \\$value\\]\"}\n" -"append :valuechangedcmd [subst {\n" -"[expr {${:multivalued} ? \":check_multiple_values\" : \":check_single_value\"}] \\[::xotcl::setinstvar \\$obj ${:name}\\] \\\n" -"{$predicate} [list ${:type}] \\$obj ${:name}}]\n" -"append __initcmd [subst -nocommands {\n" -"if {[:exists ${:name}]} {set :__oldvalue(${:name}) [set :${:name}]}\\n}]}\n" -"return $__initcmd}\n" "::xotcl::Attribute protected method init {} {\n" "next ;# do first ordinary slot initialization\n" "set __initcmd \"\"\n" @@ -421,10 +395,6 @@ "\\[list [::xotcl::self] __value_changed_cmd \\[::xotcl::self\\] [list [set :valuechangedcmd]]\\]\"}\n" "if {$__initcmd ne \"\"} {\n" "set :initcmd $__initcmd}}\n" -"::xotcl2::Class create ::xotcl::Attribute::Nocheck {\n" -":method check_single_value args {;}\n" -":method check_multiple_values args {;}\n" -":method mk_type_checker args {return \"\"}}\n" "::xotcl2::Class create ::xotcl::Attribute::Optimizer {\n" ":method method args {::xotcl::next; :optimize}\n" ":method forward args {::xotcl::next; :optimize}\n" Index: generic/predefined.xotcl =================================================================== diff -u -r4a91216d0624226fb9a64de97feccc84cc79df79 -r9a128ffc80f0c429d885af38e92c50b253cdb9e8 --- generic/predefined.xotcl (.../predefined.xotcl) (revision 4a91216d0624226fb9a64de97feccc84cc79df79) +++ generic/predefined.xotcl (.../predefined.xotcl) (revision 9a128ffc80f0c429d885af38e92c50b253cdb9e8) @@ -717,52 +717,6 @@ # puts "valuechanged obj=$obj cmd=$cmd, var=$var, op=$op, ...\n$obj exists $var -> [::xotcl::setinstvar $obj $var]" eval $cmd } - ::xotcl::Attribute method check_single_value { {-keep_old_value:boolean true} value predicate type obj var} { - #puts "+++ checking single value '$value' with $predicate ==> [expr $predicate]" - if {![expr $predicate]} { - if {[$obj exists __oldvalue($var)]} { - ::xotcl::setinstvar $obj $var [::xotcl::setinstvar $obj __oldvalue($var)] - } else { - $obj unset -nocomplain $var - } - error "'$value' is not of type $type" - } - if {$keep_old_value} {::xotcl::setinstvar $obj __oldvalue($var) $value} - #puts "+++ checking single value done" - } - - ::xotcl::Attribute method check_multiple_values {values predicate type obj var} { - foreach value $values { - :check_single_value -keep_old_value false $value $predicate $type $obj $var - } - ::xotcl::setinstvar $obj __oldvalue($var) $value - } - ::xotcl::Attribute method mk_type_checker {} { - puts stderr "[self] [self proc]" - set __initcmd "" - if {[:exists type]} { - if {[::xotcl::is ${:type} class]} { - set predicate [subst -nocommands { - [::xotcl::is \$value object] && [::xotcl::is \$value type ${:type}] - }] - } elseif {[llength ${:type}]>1} { - set predicate "\[${:type} \$value\]" - } else { - #set predicate "\[string is ${:type} \$value\]" - set predicate "\[:type=${:type} ${:name} \$value\]" - } - #puts stderr predicate=$predicate - append :valuechangedcmd [subst { - [expr {${:multivalued} ? ":check_multiple_values" : ":check_single_value" - }] \[::xotcl::setinstvar \$obj ${:name}\] \ - {$predicate} [list ${:type}] \$obj ${:name} - }] - append __initcmd [subst -nocommands { - if {[:exists ${:name}]} {set :__oldvalue(${:name}) [set :${:name}]}\n - }] - } - return $__initcmd - } ::xotcl::Attribute protected method init {} { next ;# do first ordinary slot initialization # there might be already default values registered on the class @@ -791,7 +745,6 @@ #puts stderr "::xotcl::setter ${:domain} ${:name}:$(mparam),slot=[self]" } } - #append __initcmd [:mk_type_checker] if {[:exists valuechangedcmd]} { append __initcmd ":trace add variable [list ${:name}] write \ \[list [::xotcl::self] __value_changed_cmd \[::xotcl::self\] [list [set :valuechangedcmd]]\]" @@ -801,12 +754,6 @@ } } - # mixin class for decativating all value checks in slots - ::xotcl2::Class create ::xotcl::Attribute::Nocheck { - :method check_single_value args {;} - :method check_multiple_values args {;} - :method mk_type_checker args {return ""} - } # mixin class for optimizing slots ::xotcl2::Class create ::xotcl::Attribute::Optimizer { :method method args {::xotcl::next; :optimize} Index: library/serialize/Serializer.xotcl =================================================================== diff -u -r210eab6d9149846d5d6a6a8e0fa74e232ca5b6de -r9a128ffc80f0c429d885af38e92c50b253cdb9e8 --- library/serialize/Serializer.xotcl (.../Serializer.xotcl) (revision 210eab6d9149846d5d6a6a8e0fa74e232ca5b6de) +++ library/serialize/Serializer.xotcl (.../Serializer.xotcl) (revision 9a128ffc80f0c429d885af38e92c50b253cdb9e8) @@ -359,7 +359,7 @@ set r [subst { set ::xotcl::__filterstate \[::xotcl::configure filter off\] - ::xotcl::Slot mixin add ::xotcl::Slot::Nocheck + #::xotcl::Slot mixin add ::xotcl::Slot::Nocheck ::xotcl::configure softrecreate [::xotcl::configure softrecreate] ::xotcl::setExitHandler [list [::xotcl::getExitHandler]] }]\n @@ -384,7 +384,7 @@ } append r { - ::xotcl::Slot mixin delete ::xotcl::Slot::Nocheck + #::xotcl::Slot mixin delete ::xotcl::Slot::Nocheck ::xotcl::configure filter $::xotcl::__filterstate unset ::xotcl::__filterstate }