Deutsch   English   Français   Italiano  
<viv7vj9q15o35mv2obt3gutmftelnpj2ck@4ax.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Helmut Giese <hgiese@ratiosoft.com>
Newsgroups: comp.lang.tcl
Subject: A TclOO question (for experts?)
Date: Mon, 07 Apr 2025 18:34:28 +0200
Organization: ratiosoft
Lines: 29
Message-ID: <viv7vj9q15o35mv2obt3gutmftelnpj2ck@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 07 Apr 2025 18:34:28 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="46263ab006f5f478d97fb784a65b8c63";
	logging-data="223833"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18XbpW5bkYBAQrsN1A+OyEG"
Cancel-Lock: sha1:d1uQPicbPGZ0HjdnT+cQlIq1j2w=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
Bytes: 1733

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