Sujet : Re: Are class consts possible?
De : m.n.summerfield (at) *nospam* gmail.com (Mark Summerfield)
Groupes : comp.lang.tclDate : 21. Jun 2025, 07:51:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1035kov$u2kk$1@dont-email.me>
References : 1 2 3 4
User-Agent : Pan/0.149 (Bellevue; 4c157ba)
On Fri, 20 Jun 2025 20:28:25 -0000 (UTC), Rich wrote:
Mark Summerfield <m.n.summerfield@gmail.com> wrote:
On Fri, 20 Jun 2025 13:28:13 -0000 (UTC), Rich wrote:
Mark Summerfield <m.n.summerfield@gmail.com> wrote:
Is it possible to create class-specific consts i.e., consts that
exist inside a class's namespace?
Tcl does not have "constants" in the vien of other languages
"constants".
However, there are several ways to "roll your own":
https://wiki.tcl-lang.org/page/constants
According to https://www.tcl-lang.org/man/tcl9.0/TclCmd/const.html
"const — create and initialize a constant"
And I use them quite a lot since I'm using Tcl 9.
Ah, it seems Tcl 9 added "const" capabilities.
Perhaps the wiki needs updating?
Indeed, that would seem to be the case.
I've updated the web page
https://wiki.tcl-lang.org/page/constants accordingly.