Sujet : Re: tcl hidden "cruelties"
De : aotto1968 (at) *nospam* t-online.de (aotto1968)
Groupes : comp.lang.tclDate : 13. Oct 2024, 09:25:58
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <veg06m$k12k$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 12.10.24 17:05, Ralf Fassel wrote:
* aotto1968 <aotto1968@t-online.de>
| the core question is why the NS is *NOT* created by default.
| -> If you can raise an error you can also create the namespace.
If you have ever happend to have a namespace tpyo in your 'array set'
command, and did not see it while looking straight at it for half an
hour, you would be grateful for TCL telling you that you mistyped it.
Anyway, this discussion is moot, as I don't think TCL will change in
that respect. I at least would object to auto-creating the namespace :-)
EOD4me...
R'
this is not as trivial as it look like because TCL by default is NON-declaration language.
> set myvar 1
always succeed because you don't have to "declare" the "myvar" and just set it
in difference to
> set ::myns::myvar
you have to declare the "myns" this is just an extra unnecessary step this make everything more complex without
adding any advantage.
> "If you have ever happened to have a namespace typo in your 'array set'"
as I mentioned early → you want to protect the programmer for itself → this is just a bad behavior.
You have to treat the "myns" as part of the name like "myns_myvar" etc in old TCL days without NS
> set myns_myvar 1
would never be complied by TCL because the "myns" prefix was just chosen by the programmer.
mfg