• Tcloo: initilization of class variables

    From abu@user13892@newsgrouper.org.invalid to comp.lang.tcl on Tue Jan 27 22:56:32 2026
    From Newsgroup: comp.lang.tcl


    I've read various articles and comments on how to implement class-methods
    and class-variables in Tcloo, but I've never figured out how to implement
    a class-constructor (similar to Snit's typeconstructor)
    to initialize these class-variables.

    Please, can you give me some simple examples ?
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Emiliano@emiliano@example.invalid to comp.lang.tcl on Tue Jan 27 22:50:43 2026
    From Newsgroup: comp.lang.tcl

    On Tue, 27 Jan 2026 22:56:32 GMT
    abu <user13892@newsgrouper.org.invalid> wrote:


    I've read various articles and comments on how to implement class-methods
    and class-variables in Tcloo, but I've never figured out how to implement
    a class-constructor (similar to Snit's typeconstructor)
    to initialize these class-variables.

    Please, can you give me some simple examples ?

    There is a simple example in the documentation of classvariable(n):

    https://www.tcl-lang.org/man/tcl9.0/TclCmd/classvariable.html

    The initialise/initialize command itself is documented in oo::define(n)

    https://www.tcl-lang.org/man/tcl9.0/TclCmd/define.html#M12

    Regards
    --
    Emiliano
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From abu@user13892@newsgrouper.org.invalid to comp.lang.tcl on Wed Jan 28 23:42:35 2026
    From Newsgroup: comp.lang.tcl


    That's simply good !
    I never considered these new Tcl9.x features, since I always tried to deliver code running for Tcl8.x and Tcl9.x.

    After seeing how it works for Tcl9, I think I'll abandon full Tcl8.x compatibility, because trying to implement classmethods and classvariables with Tcl8.x is simply impossible, unless you resort to very complicated tricks
    , with many limitations.

    --- Synchronet 3.21b-Linux NewsLink 1.2