• A TclOO question

    From Helmut Giese@hgiese@ratiosoft.com to comp.lang.tcl on Mon Apr 7 15:03:04 2025
    From Newsgroup: comp.lang.tcl

    Hello out there,
    look at the following sample:
    ---
    catch {Sample destroy}

    oo::class create Sample {
    variable classVar ;# automatically exists in every instance
    constructor {someVar} {
    my variable objVar
    set classVar $someVar
    set objVar 99
    }
    destructor {
    my variable objVar classVar
    puts "classVar: $classVar, objVar: $objVar"
    }
    }

    Sample create s1 100
    Sample create s2 200
    s1 destroy ;# -> classVar: 100, objVar: 99
    s2 destroy ;# -> classVar: 200, objVar: 99
    ---
    My question is: What happens, if I add 'classVar', although not
    needed, to a 'my variable' statement - like I did in the destructor
    above. Is it just superfluous or can it have consequences in a more
    complex situation than the above example.
    Thank you for any enlightenment
    Helmut
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Helmut Giese@hgiese@ratiosoft.com to comp.lang.tcl on Wed Apr 9 15:37:13 2025
    From Newsgroup: comp.lang.tcl

    Sorry for this double post.When I looked it didn't show up so I posted
    again.
    Helmut
    --- Synchronet 3.20c-Linux NewsLink 1.2