SDX as a Utility Library

see Starpal - TCL Development and Starkit generation

AMG: See SDX Enhancements for an alternative implementation of SDX as a library.


20Jan05 jcw - Latest SDX can now be used as library, see [L1 ] for an example.


Duoas Hey there. Recent versions of tcl seem to like the wonky X.YaZ version numbers, which 'package vcompare' can't quite comprehend --> resulting in a crashed tclkit whenever an attempt to source it is made. I've "repaired" my sdx.kit by changing the "sdx.vfs/main.tcl" file to read:

 package require starkit

 # old tclkits have broken "sourced" symlink detection (in their "starkit" pkg)
 # let SDX work in older ones but don't allow sourcing, which is a new feature
 if {[starkit::startup] eq "sourced" &&
     [package vcompare [lindex 0 [regsub \[a-z\] [info patchlevel] { }]] 8.4.9] >= 0} return

 package require app-sdx

The thing I am not sure about is whether I am handling the version number correctly. Should it instead read:

     [package vcompare [regsub \[a-z\] [info patchlevel] .] 8.4.9] >= 0} return

In other words, does 8.5a4 == 8.5.4?

Lars H: No, "a" is more like ".-2.", i.e., 8.5a4 < 8.5.0. See TIP#268 [L2 ].


Duoas OK, I understand now. I amend my code to the simpler:

     [package vcompare [lindex [split [info patchlevel] ab] 0] 8.4.9] >= 0} return

Which for this particular comparison is sufficient.


Either way, this needs to be addressed in the sdx.kit distribution.


LV 2007 Sep 17 I was just thinking this past week about this general topic - that it seems, to me, that it would be useful to have a general "package version comparison" function that one could use. Certainly if it were in tcllib or tcl itself then Tcl specific package versions would need to be handled.

And this page now clues me into the fact that the function does exist.

So, in regards to the above comment, please be certain to submit a formal bug report on the original problem you are attempting to solve. That way someone can track down the real problem and fix it for you.

Duoas Done. See [L3 ]. The real problem is that sdx.kit/main.tcl needs to be fixed. Relying only on the TIPped update of the package command still leaves old tclsh/wish-es unable to source SDX.