Skip to content
Tcl Source Code History Of Ticket 2704302
Login

History Of Ticket 2704302

Artifacts Associated With Ticket 2704302

  1. Ticket change [aaece0a8c5] (rid 101007) by abstractsig on 2009-03-22 21:55:39:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      With active state tcl 8.6b1.1 on windows vista the following code:
      
      package require TclOO
      namespace path ::oo
      class create A {
      method change_class {new} {
      oo::objdefine [self] class $new
      list [self class] [info object class [self]]
      }
      }
      class create B {}
      set o [A new]
      puts [$o change_class B]
      
      outputs:
      
      ::A ::B
      
      but should output
      
      ::B ::B
      
      
      
      
      
      
    4. foundin initialized to: "obsolete: 8.6b1.1"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "abstractsig"
    10. subsystem initialized to: "35. TclOO Package"
    11. title initialized to: "Incorrect return value from self class"
    12. type initialized to: "Bug"
  2. Ticket change [2fc0e55bc0] (rid 93123) by dkf on 2009-03-23 15:06:08:

    1. icomment:
      It's not clear at all to me what the correct response should be in that situation.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  3. Ticket change [25cd11e7d1] (rid 88230) by abstractsig on 2009-03-23 16:31:49:

    1. icomment:
      My logic is that the 'self class' return value should be consistent with the 'info object class' return value; a different return creates an ambiguity as to what the object's class is?
      
      The 'oo::objdefine [self] class $new' definitely changes the class of self.  In this example the behaviour of self after 'oo::objdefine [self] class $new' is ::B not ::A.
      
      
      package require TclOO
      namespace path ::oo
      class create A {
      method change_class {new} {
      oo::objdefine [self] class $new
      my change_class foo
      list [self class] [info object class [self]]
      }
      }
      class create B {
      method change_class {new} {
      puts $new
      }
      }
      set o [A new]
      puts [$o change_class B]
      
       
      
      
      
      
      
    2. login: "abstractsig"
    3. mimetype: "text/plain"
    4. username: "abstractsig"
  4. Ticket change [e19a98bbf6] (rid 87479) by dkf on 2009-03-24 17:26:48:

    1. icomment:
      Reading through the documentation again, I suppose that [self class] ought to fail if the method is not defined on a class. Will change to do that. (Will cause the problem code to throw an error, but that's probably best anyway.)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [e0b7f1099d] (rid 87327) by dkf on 2009-03-24 17:47:09:

    1. closedate changed to: "2009-03-24T10:47:09"
    2. closer changed to: "dkf"
    3. icomment:
      Also, there's arguably a case for having something in [self] to do [info object class [self]], but [self class] currently works with the method invocation and not the object.
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dkf"
  6. Ticket change [57cec42c90] (rid 117692) by abstractsig on 2009-03-25 02:05:35:

    1. icomment:
      Thanks for the comments.  I see now that my initial classification of this as a bug is a bit suspect.  
      
      But given 'self class' works on the method invocation, so it is not clear to me what it should do as it depends on your timeline.  If you want to know the name of the class corresponding to the  'current' method for a recrusive call (i.e. looking forward in time) then you need [info object class [self]],  but if you want to trace back, then you need [self class].
      
      Perhaps just a change to the documentation for 'self class' would be enough.  For example if it pointed out that it is possible that the results of self class and info object class [self] can be different.
      
      
      
      
      
      
      
      
      
      
      
    2. login: "abstractsig"
    3. mimetype: "text/plain"
    4. username: "abstractsig"
  7. Ticket change [d686593d20] (rid 123822) by dkf on 2009-07-24 15:23:36:

    1. icomment:
      
      
      allow_comments - 1
      
      Put some more info into self.n
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"