package BoF: dealing with multiple variants

Problem: package ifneeded has set semantics

Only the last package ifneeded $package $version $script is stored.

Thus, order of execution of index scripts matters. However, order of execution is not under package-author control, and it's not (***) under application-programmer control either.

Why multiple installs of same $version of $package? Variants.

Thread-enabled vs. not. Debug vs. not. etc.

Variants introduce nasty complexity -- avoid if possible.

New version number for every released change -- we are not running out of integers.

When not avoidable, use testing in index scripts to filter a single active package ifneeded

For example, for threaded variant, use this index script:

    if {![info exists tcl_platform(threaded)]} return
    if {!$tcl_platform(threaded)} {return}
    package ifneeded foo 1.1 {load libfoo1.1t.so}

And, for non-threaded variant, use this index script

    if {[info exists tcl_platform(threaded)] && $tcl_platform(threaded)} return
    package ifneeded foo 1.1 {load libfoo1.1t.so}

How to identify the variant

See TIP 59

See package BoF: PACKAGE ABOUT - metadata


*** Well, an app programmer can define a package unknown hook to do exactly what they want, but that implies knowledge of installation environment. This is the wrapped application approach, where you're not really using packages because you're not pulling them from the local environment.