Artifacts Associated With Ticket f8a20dff9c1b3259
Ticket change [5e0d91d4b8] (rid 254188) by oehhar on 2026-06-03 13:51:49:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
The description of the command "variable" [https://www.tcl-lang.org/man/tcl9.0/TclCmd/variable.html] gives the synopsis: <verbatim> variable name variable ?name value...? </verbatim> I don't know what this means. The described form is: <verbatim> variable name ?value? </verbatim> Unfortunately, the command accepts an arbitrary number of arguments, which are ignored: <verbatim> % namespace eval test {variable v1 c1 c2 c3} % set test::v1 c1 </verbatim> This is probably due to the fact, that in OO context, the command has a totally different syntax (Ashoks book, page 394): <verbatim> variable ?SLOTOPERATION? ?VARNAME ...? </verbatim> The same command "variable v1 c1" means different things: * in namespaces, a namespace variable v1 is set to c1 * in OO, the variables v1 and c1 are defined as class variables. Great ! I would love, if the command: * would give a propper error message, if used in the different contextes. * the documentation would document all this strange stuff. Sorry for my OO unskill level, it is all strange. Take care, Harald - foundin initialized to: "main"
- is_private initialized to: "0"
- login: "oehhar"
- priority initialized to: "5 Medium"
- private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "oehhar"
- subsystem initialized to: "07. Variables"
- title initialized to: "Doc: description of command "variable" incomplete"
- type initialized to: "Bug"
Ticket change [ae9d0a3b94] (rid 254189) by oehhar on 2026-06-03 13:54:01:
- comment changed to:
The description of the command "variable" [https://www.tcl-lang.org/man/tcl9.0/TclCmd/variable.html] gives the synopsis: <verbatim> variable name variable ?name value...? </verbatim> I don't know what this means. The described form is: <verbatim> variable name ?value? </verbatim> Unfortunately, the command accepts 0 to infinite arguments. Only 1 or 2 arguments do something: <verbatim> % namespace eval test {variable v1 c1 c2 c3} % set test::v1 c1 </verbatim> What is this for: <verbatim> % namespace eval test {variable} </verbatim> This is probably due to the fact, that in OO context, the command has a totally different syntax (Ashoks book, page 394): <verbatim> variable ?SLOTOPERATION? ?VARNAME ...? </verbatim> The same command "variable v1 c1" means different things: * in namespaces, a namespace variable v1 is set to c1 * in OO, the variables v1 and c1 are defined as class variables. Great ! I would love, if the command: * would give a propper error message, if used in the different contextes. * the documentation would document all this strange stuff. Sorry for my OO unskill level, it is all strange. Take care, Harald - login: "oehhar"
- mimetype: "text/plain"
- comment changed to:
Ticket change [4a91d05e4b] (rid 254195) by apnadkarni on 2026-06-04 05:25:12:
- icomment:
The use of `variable` within a class definition (`oo::define`) has different syntax and is described in the `oo::define` manpage. (It is also not a "class variable" as that term has a different meaning.) I agree it is confusing to have a different syntax for commands of the same name and with similar, but not identical function, even though in different scopes but not sure much can be done about it now.
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [5aad166024] (rid 254199) by sbron on 2026-06-04 12:30:32:
- icomment:
I frequently use the `variable` command with more than 2 arguments. I'm not sure why you claim that "[o]nly 1 or 2 arguments do something". Here's proof to the contrary: ``` % namespace eval test {variable v1 c1 v2 c2} % set test::v1 c1 % set test::v2 c2 ``` - login: "sbron"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [c6d3297683] (rid 254200) by oehhar on 2026-06-04 12:41:18:
- closedate changed to: "2461196.0286846873"
- closer changed to: "oehhar"
- icomment:
A, thanks. That makes sense. That is what the syntax in the man page eans: <verbatim> variable ?name value...? </verbatim> arbitrary number of variable name and value. If that is the interpretation, why does this not raise an error: <verbatim> namespace eval test {variable v1 c1 v2} </verbatim> This would be the syntax: <verbatim> variable ?name value...? ?name? </verbatim> Anyway, thanks for all, noise for nothing but a big dump stupid user... Sorry, bug closed. THanks, Harald - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "oehhar"