Skip to content
Tcl Source Code History Of Ticket 794298036fda15d1
Login

History Of Ticket 794298036fda15d1

Artifacts Associated With Ticket 794298036fda15d1

  1. Ticket change [3fcad87ded] (rid 163735) by anonymous on 2018-06-02 07:14:33:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      oo::class 'create' is a method.
      
      If I derive an instance of oo::class which contains a method 'create', I cannot call its create method.
      
      The following snipped should error, but does not, because Class's create method is intercepted by oo::class.  This is a bug.  One should reasonably expect to be able to override methods, and this appears to be true for other methods which one might define (in the example below) on Class.
      
      Colin.
      
      Demonstration:  I would expect Class 'create' to be called, but it is not.
      
      oo::class create Class {
          method create {args} {
      	error "Should Error, but doesn't - this is a bug, it means no oo::class instance can override create method"
          }
      }
      Class create Instance
      
      oo::class create MClass {
          superclass ::oo::class
          method create {args} {
      	error "Should Error, but doesn't - this is a bug, it means no oo::class instance can override create method"
          }
      }
      MClass create MInstance
      
    5. is_private initialized to: "0"
    6. login: "anonymous"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "16910d69b11045755316a073070779a85cd9218f"
    9. resolution initialized to: "None"
    10. severity initialized to: "Important"
    11. status initialized to: "Open"
    12. submitter initialized to: "anonymous"
    13. subsystem initialized to: "35. TclOO Package"
    14. title initialized to:
      oo::class appears to confiscate the 'create' method on all its descendants.
      
    15. type initialized to: "Bug"
  2. Ticket change [10ccc18f10] (rid 163736) by dgp on 2018-06-02 11:18:16:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2458271.97102236"
    3. closer changed to: "dgp"
    4. icomment:
      
      This looks like a confusion between the instance relationship and the
      inheritance relationship.
      
      To override [Class create], use [oo::objdefine]:
      
      % oo::class create Class {
          method create {args} {
      	error "Should Error, but doesn't - this is a bug, it means no oo::class instance can override create method"
          }
      }
      ::Class
      % Class create Instance
      ::Instance
      
      
      % oo::objdefine Class method create args {error demo}
      % Class create Demo
      demo
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"