• tcllib1.21 and tcl9.0b3

    From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Sat Sep 14 00:13:13 2024
    From Newsgroup: comp.lang.tcl

    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts. (OK,
    more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21
    starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it
    encounters

    if {(0 == [catch {
    package vcompare [info patchlevel] [info patchlevel]
    }]) && (
    [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can
    make out,

    package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same
    pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can
    work out what's happening. In the mean time, I'd very much appreciate
    any help you can provide.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Sat Sep 14 16:37:34 2024
    From Newsgroup: comp.lang.tcl

    On 14/09/2024 00:13, Alan Grunwald wrote:
    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts. (OK,
    more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21
    starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it encounters

    if {(0 == [catch {
        package vcompare [info patchlevel] [info patchlevel]
    }]) && (
        [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can
    make out,

        package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can
    work out what's happening. In the mean time, I'd very much appreciate
    any help you can provide.

    OK. I've had another look.

    Between the line

    if {[package vsatisfies [package provide Tcl] 8]} {return}

    which I have changed to ...vstaisfies... 8 9, and the multi-line command
    that I quoted above, are the lines

    # For Tcl 8.3.1 and later, that's all we need
    if {[package vsatisfies [package provide Tcl] 8.4]} {return}

    I have confirmed that on Tcl 8.6.14, the return is executed, so I have
    changed the second line to

    if {[package vsatisfies [package provide Tcl] 8.4 9]} {return}

    and the return is now executed on Tcl9.0b3. However,

    package require uri

    still fails with "can't find package uri"

    As far as I can make out, this means that the package should be fund
    using the [package unknown] mechanism.

    In both version of Tcl, [package unknown] returns

    {::tcl::tm::UnknownHandler ::tclPkgUnknown}

    I assume that since uri should be provided as a good old-fashioned
    package rather than a module, I can ignore ::tcl::tm::UnknownHandler.

    ::tclPkgUnknown appears to be unchanged between 8.6.14 and 9.0b3, apart
    from a change in 9.0b3 to use the (undocumented) flag -nopkg when
    executing [source] in a safe interpreter. Since my interpreter isn't
    safe, I think that's irrelevant.

    I'm going to try to get my head around ::tclPkgUnknown to try to track
    down what has changed.

    As before, any assistance would be very welcome.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Paul Obermeier@obermeier@poSoft.de to comp.lang.tcl on Sat Sep 14 17:57:26 2024
    From Newsgroup: comp.lang.tcl

    Am 14.09.2024 um 01:13 schrieb Alan Grunwald:
    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts. (OK, more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21 starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it encounters

    if {(0 == [catch {
        package vcompare [info patchlevel] [info patchlevel]
    }]) && (
        [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can make out,

        package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can work out what's happening. In the mean time, I'd very much appreciate any help you can provide.


    Hi Alan,

    tcllib 1.21 is not Tcl9 ready.
    You should try the current trunk of tcllib.
    Andreas Kupries committed some more Tcl9 related changes just yesterday.

    Also note, that there is a RC0 candidate of Tcl9 (https://sourceforge.net/projects/tcl/files/Tcl/9.0.0/)

    Paul


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Sat Sep 14 17:40:37 2024
    From Newsgroup: comp.lang.tcl

    On 14/09/2024 16:37, Alan Grunwald wrote:
    On 14/09/2024 00:13, Alan Grunwald wrote:
    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts.
    (OK, more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21
    starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it
    encounters

    if {(0 == [catch {
         package vcompare [info patchlevel] [info patchlevel]
    }]) && (
         [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can
    make out,

         package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should
    always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same
    pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can
    work out what's happening. In the mean time, I'd very much appreciate
    any help you can provide.

    OK. I've had another look.

    Between the line

        if {[package vsatisfies [package provide Tcl] 8]} {return}

    which I have changed to ...vstaisfies... 8 9, and the multi-line command that I quoted above, are the lines

        # For Tcl 8.3.1 and later, that's all we need
        if {[package vsatisfies [package provide Tcl] 8.4]} {return}

    I have confirmed that on Tcl 8.6.14, the return is executed, so I have changed the second line to

        if {[package vsatisfies [package provide Tcl] 8.4 9]} {return}

    and the return is now executed on Tcl9.0b3. However,

        package require uri

    still fails with "can't find package uri"

    As far as I can make out, this means that the package should be fund
    using the [package unknown] mechanism.

    In both version of Tcl, [package unknown] returns

        {::tcl::tm::UnknownHandler ::tclPkgUnknown}

    I assume that since uri should be provided as a good old-fashioned
    package rather than a module, I can ignore ::tcl::tm::UnknownHandler.

    ::tclPkgUnknown appears to be unchanged between 8.6.14 and 9.0b3, apart
    from a change in 9.0b3 to use the (undocumented) flag -nopkg when
    executing [source] in a safe interpreter. Since my interpreter isn't
    safe, I think that's irrelevant.

    I'm going to try to get my head around ::tclPkgUnknown to try to track
    down what has changed.

    As before, any assistance would be very welcome.
    Hey ho.

    I had a look on the wiki and found https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9#40a2085371b8effbae526101c0fd639a2ed6604c16513802a0e05bd3d9b8e1b0
    which includes a table listing packages that have been ported. The table includes tcllib 2.0 pointing to https://www.tcl3d.org/bawt/download/InputLibs/tcllib-2.0.7z

    I've added tcllib 2.0 to my tcl9.0b3 installation and it passes my crude
    test, i.e.

    package require uri

    completes successfully.

    Thanks to anyone who has been reading.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Alan Grunwald@nospam.nurdglaw@gmail.com to comp.lang.tcl on Sat Sep 14 17:46:47 2024
    From Newsgroup: comp.lang.tcl

    On 14/09/2024 16:57, Paul Obermeier wrote:
    Am 14.09.2024 um 01:13 schrieb Alan Grunwald:
    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts.
    (OK, more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21
    starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it
    encounters

    if {(0 == [catch {
         package vcompare [info patchlevel] [info patchlevel]
    }]) && (
         [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can
    make out,

         package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should
    always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same
    pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can
    work out what's happening. In the mean time, I'd very much appreciate
    any help you can provide.


    Hi Alan,

    tcllib 1.21 is not Tcl9 ready.
    You should try the current trunk of tcllib.
    Andreas Kupries committed some more Tcl9 related changes just yesterday.

    Also note, that there is a RC0 candidate of Tcl9 (https://sourceforge.net/projects/tcl/files/Tcl/9.0.0/)

    Paul


    Thanks Paul - I've just spotted a reference to tcllib 2.0 on the wiki;
    see a message in a sibling thread.

    I think I'll press on with 9.0b3 and hope to get that going happily just before 9.0 hits the streets :-). Where is the tcllib repo?

    Alan
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Paul Obermeier@obermeier@poSoft.de to comp.lang.tcl on Sat Sep 14 19:12:25 2024
    From Newsgroup: comp.lang.tcl

    Am 14.09.2024 um 18:46 schrieb Alan Grunwald:
    On 14/09/2024 16:57, Paul Obermeier wrote:
    Am 14.09.2024 um 01:13 schrieb Alan Grunwald:
    How compatible is tcllib 1.21 with tcl9.0b3?

    I've built tcl-9.0b3 and want to see how it plays with my scripts. (OK, more properly that should be "how my scripts play with tcl 9.0b3.)

    I'm testing with a script that includes [package require uri].

    This fails, saying it can't find the package.

    I've dug around a bit and I see that the pkgIndex.tcl in tcllib-1.21 starts with a fast return if

    [package vsatisfies [package provide Tcl] 8]

    returns 0.

    I've changed that to

    [package vsatisfies [package provide Tcl] 8 9]

    and it now gets a couple of lines further down the script where it encounters

    if {(0 == [catch {
         package vcompare [info patchlevel] [info patchlevel]
    }]) && (
         [package vcompare [info patchlevel] 8.3.1] >= 0
    )} {return}

    and returns.

    I don't understand this line well enough to change it. As far as I can make out,

         package vcompare [info patchlevel] [info patchlevel]

    will always return 0 and won't throw an exception, so this should always result in a premature return, before all the

    package ifneeded

    commands for the packages withing tcllib are executed.

    However, that argument applies equally to tcl8.6.14, but the same pkgIndex.tcl works just fine on my home-built copy of that.

    It's getting late and I'll have another look tomorrow and see if I can work out what's happening. In the mean time, I'd very much appreciate any help you can provide.


    Hi Alan,

    tcllib 1.21 is not Tcl9 ready.
    You should try the current trunk of tcllib.
    Andreas Kupries committed some more Tcl9 related changes just yesterday.

    Also note, that there is a RC0 candidate of Tcl9 (https://sourceforge.net/projects/tcl/files/Tcl/9.0.0/)

    Paul


    Thanks Paul - I've just spotted a reference to tcllib 2.0 on the wiki; see a message in a sibling thread.

    I think I'll press on with 9.0b3 and hope to get that going happily just before 9.0 hits the streets :-). Where is the tcllib repo?

    It's here: https://core.tcl-lang.org/tcllib/doc/trunk/embedded/index.md

    Alan

    --- Synchronet 3.20a-Linux NewsLink 1.114