Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-01-26
00:59 • Ticket [1101678fff] rewrite pkg_mkIndex -lazy to generate tclIndex file st... artifact: 71e791e682 user: dgp
2005-01-19
22:43 • Open ticket [1101678fff]. artifact: 76a05aa80c user: dgp
2005-01-18
16:55 • Ticket [1101678fff]: 5 changes artifact: dfd56e8084 user: vincentdarley
2005-01-14
18:23 • Ticket [1101678fff]: 4 changes artifact: 230c7348ca user: vincentdarley
2005-01-13
22:46 • Closed ticket [1101678fff]. artifact: 84a45f60dc user: dgp
21:52 • Ticket [1101678fff]: 5 changes artifact: e123fcc36a user: vincentdarley
21:48 • Add attachment runtest.tcl to ticket [1101678fff] artifact: 753df81c1b user: vincentdarley
21:48 • Ticket [1101678fff] auto_reset conflicts with tclPkgSetup status still Open ... artifact: efa6b929f0 user: vincentdarley
14:48 • New ticket [1101678fff]. artifact: 369e2b9273 user: vincentdarley

rewrite [pkg_mkIndex -lazy] to generate tclIndex file

Open1101678fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-01-13 14:48:58
The attached script creates a package 'testpkg' which
provides two auto-loadable procs 'testpkg::one' and
'testpkg::two'.

If we execute 'testpkg::one', then do 'auto_reset' and
then try to execute 'testpkg::two', the latter is no
longer available -- the auto_index entry has been cleared.

Or, for example:

package require testpkg
# Now 'testpkg::one' and 'testpkg::two' are both available
# for auto-loading and execution
auto_reset
# Now both of those procs have been lost!
vincentdarleyplain2005-01-13 21:48:58
File Added - 115691: runtest.tcl
vincentdarleyplain2005-01-13 21:52:25
Logged In: YES 
user_id=32170

Note that bug 1101670 means that after auto_loading of all
of the procs provided by the given package, we will no
longer see this bug -- i.e. bug 1101670 is masking some
possible occurrences of this problem, at least for good
packages that place their code inside a namespace.

This is because 1101670 implies that procs in a namespace
will not be deleted.

A more general comment: the basic conflict seems to arise
because auto_reset assumes all auto_index entries can be
regenerated from tclIndex files, so it's ok to delete them,
but auto_index entries created by tclPkgSetup cannot be
recreated...
dgpplain2005-01-13 22:46:31
Logged In: YES 
user_id=80530

On this one, I'll agree that
there's a misfeature, but
there's no bug here.

The real misfeature is
[tclPkgSetup], and the
[pkg_mkIndex -lazy] that
creates it.  Don't use either.
They're broken by design
and not worth fixing.

If you want auto-loading
in your package, create
the appropriate tclIndex
file to make it happen.
vincentdarleyplain2005-01-14 18:23:56
Logged In: YES 
user_id=32170

Can we at least document that pkg_mkIndex -lazy should not
be used so others don't fall into this trap.

Or, better yet, document what _should_ be used instead! 
This is not a theoretical problem, this report comes from
attempting to use the package tclAE which is part of
Daniel's BI distribution for MacOS X.
vincentdarleyplain2005-01-18 16:55:19
Logged In: YES 
user_id=32170

I've added a comment to '-lazy' to suggest it not be used.

However, I still think there's a problem here, at least in
the documentation, and probably in limitations of
pkg_mkIndex.  The documentation says you should use
'pkg_mkIndex', and goes to some lengths to explain simple vs
complex packages, dependencies etc.

However, the end result is simply that 'pkg_mkIndex' works
well for a package composed of a single file (whether .dll
or .tcl), but anything more than that, given that -lazy is
buggy, requires one to manually created a tclIndex file and
then manually create a pkgIndex.tcl file (which has to add
$dir to the auto_path).

Surely pkg_mkIndex should do that for me.  In fact, why not
re-write the '-lazy' implementation to do just that:

-lazy will:

(i) build its list of source-able procs and load-able
commands as per normal.
(ii) Then it will write those things to a new tclIndex file
in the given directory (this is a new step).
(iii) Finally it will construct a pkgIndex.tcl file which
adds the relevant $dir to the auto_path.

In this way we would have something that actually _works_,
has no problems with 'auto_reset', and has the properties of
'-lazy' that we want (don't source every single script in a
multi-script package unless we actually need them).
dgpplain2005-01-19 22:43:55
data_type - 360894

Logged In: YES 
user_id=80530

interesting idea.  I'd need to think
about it and look over the code
implications, but I like it enough
to make it a Feature Request.
dgp Ticket [1101678fff]: 1 change [History diff]2005-01-26 00:59:38
Log in (anonymous is fine) to add a comment.

Attachments: