Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 60227c02a45d537eb2c8345c5b65b941d43e5cbb
Ticket: 9d61624b3deb9fc676d69a59e0213e61cf8e5fb1
empty superclass slot is not always equivalent to oo::object
User & Date: anonymous on 2013-07-07 22:17:10
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    If you do not define a superclass for $class, then oo::object will be
    the superclass of $class. This is explained in the documentation
    (of oo::define) as "an empty parent class is equivalent to oo::object".
    However, if you do oo::define $class { superclass }, then the superclass
    slot is made empty, but does not again become equivalent to oo::object.
    A crash can be caused. Example:
    
    % oo::class create fruit {
        method eat {} {
            puts "yummy!"
        }
    }
    ::fruit
    % set f [fruit new]
    ::oo::Obj12
    % info object class $f oo::object
    1
    % info class superclasses fruit
    ::oo::object
    % oo::define fruit { superclass }
    % info class superclasses fruit
    % info object class $f oo::object
    0
    % info object isa object $f
    1
    % $f destroy 
    impossible to invoke method "destroy": no defined method or unknown method
    % info class call fruit destroy
    cannot construct any call chain
    % $f
    Segmentation fault (core dumped)
    
    -Marcel van der Goot
    
  5. foundin changed to: "8.6.0"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "f911612b13fc724ee2ff97acb8261b48c1b25f3c"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "35. TclOO Package"
  15. title changed to:
    empty superclass slot is not always equivalent to oo::object
    
  16. type changed to: "Bug"