|
From: Donald G P. <dg...@ni...> - 2005-01-24 18:07:58
|
> > if {![package vsatisfies [package provide Tcl] 8.5]} {return}
> > if {[catch {package present Tk 8.5}] != 0} {return}
> > if {[tk windowingsystem] ne "x11"} {return}
> > package ifneeded Tile 0.5 [list load [file join $dir libtile.so]]
>
> Is that going to address the issue - how to selectively load the shared
> library depending on the windowing system when Tk hasn't necessarily
> been "package required" when the Tile pkgIndex.tcl runs?
The index script above is for the Tile 0.5 shared library that is
configured to work with X11.
There could be another Tile 0.5 shared library configured to work
with Aqua. It would have its own index script, nearly the same
as above, but with "aqua" appearing where "x11" appears above.
This scheme allows either one or both variants of the package to
be installed independently. If both are installed, [tclPkgUnknown]
will run both index scripts and the proper [package ifneeded] command
will be evaluated.
If package Tk is not present at the time of [package require Tile 0.5],
then the Tile package will not be found. The index script(s) above
require the application to do:
package require Tk 8.5
package require Tile 0.5
in order. Since I cannot imagine any application that will use
Tile commands that would not also use Tk commands, I don't think
this limitation imposes any burden.
| Don Porter Mathematical and Computational Sciences Division |
| don...@ni... Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
|
|
From: Donald G P. <dg...@ni...> - 2005-01-25 16:58:26
|
> I don't like it because you are forcing an error situation
> every time that pkgIndex.tcl is hit.
Agreed. Here's the improved index script:
if {![package vsatisfies [package provide Tcl] 8.5]} {return}
if {[package provide Tk] eq ""} {return}
if {![package vsatisfies [package provide Tk] 8.5]} {return}
if {[tk windowingsystem] ne "x11"} {return}
package ifneeded Tile 0.5 [list load [file join $dir libtile.so]]
I'd like it better if [package present] had a more sensible
interface. But it doesn't. A [package vsatisfies] that
didn't error on a "" argument might help out as well.
| Don Porter Mathematical and Computational Sciences Division |
| don...@ni... Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
|
|
From: Steve L. <st...@Di...> - 2005-01-24 22:15:29
|
On 25/01/2005, at 2:07 AM, Donald G Porter wrote:
>
>>> if {![package vsatisfies [package provide Tcl] 8.5]} {return}
>>> if {[catch {package present Tk 8.5}] != 0} {return}
>>> if {[tk windowingsystem] ne "x11"} {return}
>>> package ifneeded Tile 0.5 [list load [file join $dir libtile.so]]
>>
>> Is that going to address the issue - how to selectively load the
>> shared
>> library depending on the windowing system when Tk hasn't necessarily
>> been "package required" when the Tile pkgIndex.tcl runs?
....
> This scheme allows either one or both variants of the package to
> be installed independently. If both are installed, [tclPkgUnknown]
> will run both index scripts and the proper [package ifneeded] command
> will be evaluated.
>
> If package Tk is not present at the time of [package require Tile 0.5],
> then the Tile package will not be found. The index script(s) above
> require the application to do:
>
> package require Tk 8.5
> package require Tile 0.5
>
> in order. Since I cannot imagine any application that will use
> Tile commands that would not also use Tk commands, I don't think
> this limitation imposes any burden.
OK, that answers my question. You are assuming that Tk is present.
No problems - I agree that it isn't an undue burden. But it is a change
from the current situation.
What do others think?
Steve
|
|
From: Jeff H. <je...@Ac...> - 2005-01-24 23:20:40
|
> > If package Tk is not present at the time of [package require Tile
> > 0.5], then the Tile package will not be found. The index script(s)
> > above require the application to do:
> >
> > package require Tk 8.5
> > package require Tile 0.5
> >
> > in order. Since I cannot imagine any application that will use Tile
> > commands that would not also use Tk commands, I don't think this
> > limitation imposes any burden.
>
> OK, that answers my question. You are assuming that Tk is present.
>
> No problems - I agree that it isn't an undue burden. But it is a change
> from the current situation.
>
> What do others think?
I don't like it because you are forcing an error situation
every time that pkgIndex.tcl is hit. catch'es with errors
are actually expensive. I think it should avoid those
situations, instead being a bit more refined to not error
as much (same general code-path, just slightly different).
I'm not sure exactly what was intended from the original
design, but something more like:
if {[info tclversion] != 8.4} { return }
if {[package provide Tk] eq ""} { return }
....
Note that you can't use 'eq' in an expr before checking 8.4+
compatability.
Jeff
|
|
From: Brian G. <bgr...@mo...> - 2005-01-25 00:32:27
|
Jeff Hobbs wrote:
> I don't like it because you are forcing an error situation
>
>every time that pkgIndex.tcl is hit. catch'es with errors
>are actually expensive. I think it should avoid those
>situations, instead being a bit more refined to not error
>as much (same general code-path, just slightly different).
>I'm not sure exactly what was intended from the original
>design, but something more like:
>
>if {[info tclversion] != 8.4} { return }
>if {[package provide Tk] eq ""} { return }
> ....
>
>Note that you can't use 'eq' in an expr before checking 8.4+
>compatability.
>
>
You also shouldn't use floating point number comparison on a string that
isn't really a floating point number.
if {![string equal [info tclversion] "8.4"]} ...
-Brian
--
-------------------------------------------------------------
-- Model Technology Inc. --
-- 8005 SW Boeckman Road 503.685.7000 tel --
-- Wilsonville, OR 97070 USA 503.685.0921 fax --
-------------------------------------------------------------
-- Technical support ............ mailto:su...@mo... --
-- Sales and marketing info ....... mailto:sa...@mo... --
-- Licensing .................... mailto:li...@mo... --
-- Home Page ........................ http://www.model.com --
-- AIM ........................................ bgriffin42 --
-------------------------------------------------------------
|
|
From: Jeff H. <je...@Ac...> - 2005-01-25 00:34:40
|
> You also shouldn't use floating point number comparison on a
> string that isn't really a floating point number.
>
> if {![string equal [info tclversion] "8.4"]} ...
Agreed ... but better change that to 'string compare' to work
with Tcl <=8.1. ;)
Jeff
|
|
From: Steve L. <st...@Di...> - 2005-01-25 10:20:49
|
On 25/01/2005, at 8:32 AM, Jeff Hobbs wrote:
>> You also shouldn't use floating point number comparison on a
>> string that isn't really a floating point number.
>>
>> if {![string equal [info tclversion] "8.4"]} ...
>
> Agreed ... but better change that to 'string compare' to work
> with Tcl <=8.1. ;)
Cool - I'll take that as a commitment that you'll backport Tile to <=
8.1 :)
Steve
|