| Ticket UUID: | 858a615194b96b1e3d865bea1b1487b966e3dc24 | ||
| Title: | oo::define supports classvariable but this is not really documented | ||
| Type: | Bug | Created on: | 2025-10-08 09:23:33 |
| Submitter: | mnsummerfield | Assigned to: | nobody |
| Subsystem: | 10. Objects | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2026-01-12 03:55:53 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 9 | ||
| Description: | ||||
On page https://www.tcl-lang.org/man/tcl9.0/TclCmd/define.html if you search for 'classvariable' you will find an example that shows how to create a class variable. (1) There is no mention of classvariable on this page apart from the example. Surely there ought to be? (2) There is no mention that it is possible to create class constants. However, "Emiliano" shows that this can be done: https://comp.lang.tcl.narkive.com/RtoJyYzS/are-class-consts-possible#post7 Again, shouldn't this be documented? | ||||
| User Comments: | ||||
cdubois added on 2026-01-12 03:55:53:
Thanks for the report. oo::define classvariable appears to be implemented and usable today, but it is missing from the formal command list on the oo::define manpage. I can put together a small doc patch to add it to the definitions section (with a short description alongside the other oo::define subcommands). On “class constants”: as far as I can tell TclOO does not provide a dedicated constant mechanism, so what people do here is an idiom. I suggest we first fix the clear documentation omission for classvariable, and then (if maintainers agree) add a brief note in the examples/notes clarifying the recommended pattern for read-only class-level values. | ||||
