Index: openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl,v diff -u -N -r1.9 -r1.9.2.1 --- openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl 12 Aug 2013 20:01:06 -0000 1.9 +++ openacs-4/packages/xotcl-core/tcl/10-recreation-procs.tcl 14 Feb 2014 18:20:44 -0000 1.9.2.1 @@ -16,10 +16,10 @@ if {![::xotcl::Object isclass ::xotcl::RecreationClass]} { ::xotcl::Class create ::xotcl::RecreationClass -ad_doc {

This meta-class controlls the behavior of classes (and optionally - their instances), when the classes (or their instances) are + their instances), when the classes (or their instances) are overwritten by same named new objects; we call this situation a recreate of an object.

- +

Normally, when files with e.g. class definitions are sourced, the classes and objects are newly defined. When e.g. class definitions exists already in this file, these classes are @@ -42,7 +42,7 @@

  • reconfigure: reconfigure class (default 1)
  • reinit: run init after configure for this class (default unset)
  • instrecreate: handle recreate of class instances (default unset) - When this flag is set to 0, instreconfigure and instreinit are ignored. + When this flag is set to 0, instreconfigure and instreinit are ignored.
  • instreconfigure: reconfigure instances of this class (default 1)
  • instreinit: re-init instances of this class (default unset) @@ -54,43 +54,43 @@ {instreinit} } -superclass ::xotcl::Class \ -instproc recreate {obj args} { - #my log "### recreateclass instproc $obj <$args>" - # the minimal reconfiguration is to set the class and remove methods - $obj class [self] - foreach p [$obj info procs] {$obj proc $p {} {}} - if {![my exists instrecreate]} { - #my log "### no instrecreate for $obj <$args>" - next - return - } - if {[my exists instreconfigure]} { - # before we set defaults, we must unset vars - foreach var [$obj info vars] {$obj unset $var} - # set defaults and run configure + #my log "### recreateclass instproc $obj <$args>" + # the minimal reconfiguration is to set the class and remove methods + $obj class [self] + foreach p [$obj info procs] {$obj proc $p {} {}} + if {![my exists instrecreate]} { + #my log "### no instrecreate for $obj <$args>" + next + return + } + if {[my exists instreconfigure]} { + # before we set defaults, we must unset vars + foreach var [$obj info vars] {$obj unset $var} + # set defaults and run configure $obj set_instance_vars_defaults - $obj configure {*}$args - #my log "### instproc recreate $obj + configure $args ..." - } - if {[my exists instreinit]} { - #my log "### instreinit for $obj <$args>" - $obj init - #my log "### instproc recreate $obj + init ..." - } + $obj configure {*}$args + #my log "### instproc recreate $obj + configure $args ..." + } + if {[my exists instreinit]} { + #my log "### instreinit for $obj <$args>" + $obj init + #my log "### instproc recreate $obj + init ..." + } } -proc recreate {obj args} { - #my log "### recreateclass proc $obj <$args>" - # the minimal reconfiguration is to set the class and remove methods - $obj class [self] - foreach p [$obj info instprocs] {$obj instproc $p {} {}} - if {[my exists reconfigure]} { - # before we set defaults, we must unset vars - foreach var [$obj info vars] {$obj unset $var} - # set defaults and run configure + #my log "### recreateclass proc $obj <$args>" + # the minimal reconfiguration is to set the class and remove methods + $obj class [self] + foreach p [$obj info instprocs] {$obj instproc $p {} {}} + if {[my exists reconfigure]} { + # before we set defaults, we must unset vars + foreach var [$obj info vars] {$obj unset $var} + # set defaults and run configure $obj set_instance_vars_defaults - $obj configure {*}$args - } - if {[my exists reinit]} { - $obj init - } + $obj configure {*}$args + } + if {[my exists reinit]} { + $obj init + } } ::Serializer exportObjects { @@ -173,4 +173,11 @@ my log "-- [self args]"; next } #::xotcl::Class instmixin RR -} \ No newline at end of file +} + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: