Skip to content
Tcl Source Code History Of Ticket 4af2f209f29c3d12
Login

History Of Ticket 4af2f209f29c3d12

Artifacts Associated With Ticket 4af2f209f29c3d12

  1. Ticket change [1e8d57e2c7] (rid 144496) by anonymous on 2016-01-16 09:22:45:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      This next example doesn't work.
      
      oo::class create c {
          constructor {} {
              oo::define [self class] variable var1
              set var1 something
          }
          
          method x {} {
              puts $var1
          }
      
      }
      
      c create a
      
      a x
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "35. TclOO Package"
    15. title initialized to: "oo::define variable"
    16. type initialized to: "Bug"
  2. Ticket change [ad61276f6f] (rid 144506) by aku on 2016-01-16 18:00:04:

    1. assignee changed to: "dkf"
    2. login: "aku"
    3. mimetype: "text/plain"
  3. Ticket change [d9649e06af] (rid 144507) by aspect on 2016-01-17 13:43:45:

    1. icomment:
      Playing around with this a little further, the quirk seems to be in how variables behave that are added to a class while a method is running.
      
      oo::class create D {
          method a {} {
              oo::define [self class] variable var
              puts [namespace which -variable var]\t[incr var]
          }
      }
      
      D create b
      b a
      # ::oo::Obj12::var        1
      b a
      # ::oo::Obj12::var        1
      b a
      # ::oo::Obj12::var        2
      
      
      According to [namespace which] and [info vars], $var immediately refers to the instance variable.  But that wasn't the case when the first call to [b a] was entered, so (it seems) incrScalar1Imm hits a local.
      
      Inhibiting compilation of [incr var] changes the behaviour -- TclIncrObj finds the instance variable each time.
      
    2. login: "aspect"
    3. mimetype: "text/plain"
    4. username: "aspect"
  4. Ticket change [97b9725b31] (rid 148387) by dkf on 2016-08-20 15:53:25:

    1. icomment:
      Adjusting the variable resolver's rules on a class from within a running <s>method</s> constructor? Yuck. There's literally no way to make that nice and reliable without slowing ordinary code down. The core issue is that compiled variables are resolved earlier, during the creation of the stack frame (with some magic caching to speed it up), but when there's a direct lookup by name that's done through the resolver anyway. Since the resolver is <i>by design</i> expensive and reliant on compilation for speed, there's no way we want to bring it in on every variable access. There's a minor issue that we could fix things by doing a bytecode flush when the resolver is changed... but it is such a nasty edge case. There's really no good reason to do this that I can think of and there are trivial workarounds (e.g., mixing in a class would work better).
      
      I really don't think we'll ever fix this. There's literally no good way to do it.
      
    2. login: "dkf"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Wont Fix"
    5. username: "dkf"
  5. Ticket change [cdf4d94d2d] (rid 233510) by dkf on 2024-09-17 08:42:52:

    1. login: "dkf"
    2. mimetype: "text/plain"
    3. status changed to: "Pending"
  6. Ticket change [bc9bb61a4d] (rid 258126) by serhiy.storchaka on 2026-10-15 11:29:05:

    1. icomment: "Closing: decided above."
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. status changed to: "Closed"
  7. Ticket change [f029ff4098] (rid 259929) by serhiy.storchaka on 2026-10-22 17:19:26:

    1. closedate changed to: "2461328.978539097"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"