Posted to tcl by apw at Mon Jun 30 08:50:07 GMT 2008view pretty

I think Donal was right in having no error is there is no next call possible, see the following example:

without the next in class cl1, cl3 constructor cannot be called, but with the next command in, there is a problem for creation of obj2, as there is no next command to be called.


#!/usr/bin/env tclsh

package require TclOO 0.4

::oo::class create cl1 {
  constructor {args} {
    puts stderr "cl1::constructor"
    next
  }
}

::oo::class create cl2 {
  superclass cl1

  constructor {args} {
    next
    puts stderr "cl2::constructor"
  }
}

::oo::class create cl3 {
  constructor {args} {
    puts stderr "cl3::constructor"
  }
}


::oo::class create cl4 {
  superclass cl2 cl3

  constructor {args} {
    puts stderr "cl4::constructor"
    next
  }
}

puts stderr "creating obj1"
cl4 create obj1
puts stderr "creating obj2"
cl2 create obj2