Don Porter wrote:
> Andrew Falanga wrote:
>>Why does that first call to package require seem to "include" virtually
>>all possible packages in the auto_path variable?
>
> First, note that [package names] does *not* return all packages
> that are "present" in the interp. It returns names of all packages
> that Tcl knows how to make present in the interp.
Ok, that makes sense compared to what I'm seeing.
>
> Try [package unknown] in your interpreter. It will return
> tclPkgUnknown. That indicates it is the [tclPkgUnknown] command
> that is registered to find installed packages. This is the default.
>
> Why does [tclPkgUnknown] go find all packages when it goes looking
> for just one? Because that's how it was written. The design intent
> is lost to history, best I can tell, but this has been the default
> behavior of Tcl as long as the [package] command has existed, so
> I'm surprised that you are surprised by it.
>
I haven't had much use for packages until very recently, and the level
to which I've used packages before didn't require the "finesse" that I'm
finding I need now. It surprised me because I hadn't much experience
with packages prior.
> If you wish, you can use [package unknown] to register a different
> package finding command that operates more to your liking, but
> you may run into compatibility issues with packages that assume
> the default finder when performing their install.
>
This sounds like an interesting solution, but given your warning I don't
think I'll take this path at this time.
Thanks Don and Eric for you quick responses and for clearing up my
confusion.
--
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Received on Sun Apr 30 02:57:41 2006