• Tcl: Shared directory for .tm modules across 8.6 and 9.0?

    From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Tue May 6 00:35:38 2025
    From Newsgroup: comp.lang.tcl

    Hello,
    I'm using .tm modules on Linux (Debian) and currently have the
    following environment variables set (.profile, .bashrc, .xsessionrc ):


    export TCL8_6_TM_PATH="$HOME/lib/tcl8.6/site-tcl"
    export TCL9_0_TM_PATH="$HOME/lib/tcl9.0/site-tcl"


    This works fine. However:
    is there a way to define a shared directory for .tm modules that can be
    used by multiple Tcl versions, such as both 8.6 and 9.0?

    Or is it strictly required to duplicate the .tm files in
    version-specific directories, since each tclsh only reads its own TCLx_y_TM_PATH?

    Goal:
    I'd like to maintain a single central module directory (e.g., ~/lib/tm/
    or ~/lib/shared-tms/) for use across all versions of Tcl I have installed.


    Best regards,
    Greg
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Rich@rich@example.invalid to comp.lang.tcl on Mon May 5 22:45:24 2025
    From Newsgroup: comp.lang.tcl

    greg <gregor.ebbing@gmx.de> wrote:
    Hello,
    I'm using .tm modules on Linux (Debian) and currently have the
    following environment variables set (.profile, .bashrc, .xsessionrc ):


    export TCL8_6_TM_PATH="$HOME/lib/tcl8.6/site-tcl"
    export TCL9_0_TM_PATH="$HOME/lib/tcl9.0/site-tcl"


    This works fine. However:
    is there a way to define a shared directory for .tm modules that can be
    used by multiple Tcl versions, such as both 8.6 and 9.0?

    From the 'tm' man page (https://www.tcl-lang.org/man/tcl8.6.11/TclCmd/tm.html):

    $::env(TCLX_y_TM_PATH)
    A list of paths, separated by either : (Unix) or ; (Windows). This
    is user and site specific as this environment variable can be set
    not only by the user's profile, but by system configuration scripts
    as well.

    Note the "a list" and "separated by either : or ;" parts of the
    documentation.

    Just create a shared dir, and add the shared dir to both variables,
    i.e. (assuming Unix
    below):

    export TCL8_6_TM_PATH="$HOME/lib/tcl8.6/site-tcl:$HOME/lib/tcl-shared/stuff"

    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Wed May 7 01:58:28 2025
    From Newsgroup: comp.lang.tcl

    Am 06.05.25 um 00:45 schrieb Rich:
    greg <gregor.ebbing@gmx.de> wrote:
    Hello,
    I'm using .tm modules on Linux (Debian) and currently have the
    following environment variables set (.profile, .bashrc, .xsessionrc ):


    export TCL8_6_TM_PATH="$HOME/lib/tcl8.6/site-tcl"
    export TCL9_0_TM_PATH="$HOME/lib/tcl9.0/site-tcl"


    This works fine. However:
    is there a way to define a shared directory for .tm modules that can be
    used by multiple Tcl versions, such as both 8.6 and 9.0?

    From the 'tm' man page (https://www.tcl-lang.org/man/tcl8.6.11/TclCmd/tm.html):

    $::env(TCLX_y_TM_PATH)
    A list of paths, separated by either : (Unix) or ; (Windows). This
    is user and site specific as this environment variable can be set
    not only by the user's profile, but by system configuration scripts
    as well.

    Note the "a list" and "separated by either : or ;" parts of the documentation.

    Just create a shared dir, and add the shared dir to both variables,
    i.e. (assuming Unix
    below):

    export TCL8_6_TM_PATH="$HOME/lib/tcl8.6/site-tcl:$HOME/lib/tcl-shared/stuff"


    Hello,
    thanks, that's exactly what I was looking for.

    Gregor
    --- Synchronet 3.20c-Linux NewsLink 1.2