Sujet : Re: A TclOO question (for experts?)
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 14. Apr 2025, 10:08:05
Autres entêtes
Message-ID : <ygawmbndsay.fsf@akutech.de>
References : 1 2 3
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* Helmut Giese <
hgiese@ratiosoft.com>
| | →
https://x.com/i/grok/share/Wo4XKUycnscf3WNTbpMoms93f| that's really cool: a complete, detailed analysis which even I
| understood. Many thanks for this link
The text created by the AI contains a subtle error: it makes a
difference between "variable foo" at class level and "my variable foo"
at method level as the former being a "class-wide" variable (shared
across instances, 'static' in C++, 'common' in itcl) and the latter
"instance-specific" ones (specific to one object):
[Complex situations, p2]
...
["my variable classVar" in method without previous "variable classVar" at class level]
...
In this case, classVar becomes an instance-specific variable, not a
class-wide one, which could lead to unexpected behavior if the
intent was to share classVar across instances.
As far as I understand it, this is not the case. Also the code you
posted cleary shows that classVar is *not* shared between instances
(each object has it's own value).
Maybe someone with more knowlegde on this can share some insight?
R'