From: Andrew Cheong on
This is the code:

===

package provide Report 1.0

namespace eval ::Report::Html::Table {
namespace export Merge
namespace export Create
}

namespace eval ::Report::Html::Histogram {
namespace export Create
}

proc ::Report::Html::Table::Merge {} { ... }

proc ::Report::Html::Table::Create {} { ... }

proc ::Report::Html::Histogram::Create {} { ... }

===

When I run pkg_mkIndex, I don't see any of the above in pkgIndex.tcl.
I have to rename one of the Create's to something else for it to
work. The procedures are in their own namespaces--why is this
conflict happening? Is there a way to get around it? Thank you.
From: Don Porter on
Andrew Cheong wrote:
> package provide Report 1.0
>
> namespace eval ::Report::Html::Table {
> namespace export Merge
> namespace export Create
> }
>
> namespace eval ::Report::Html::Histogram {
> namespace export Create
> }
>
> proc ::Report::Html::Table::Merge {} { ... }
>
> proc ::Report::Html::Table::Create {} { ... }
>
> proc ::Report::Html::Histogram::Create {} { ... }

> When I run pkg_mkIndex, I don't see any of the above in pkgIndex.tcl.

What is it you believe you want to see in pkgIndex.tcl ?

Be aware that the recommended practice changed from using -lazy to
using -direct many years ago. If you're insisting on sticking with
-lazy indexing, be prepared to explain why.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter(a)nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
From: Andrew Cheong on
On Aug 9, 2:09 pm, Don Porter <d...(a)nist.gov> wrote:
> Andrew Cheong wrote:
> > package provide Report 1.0
>
> > namespace eval ::Report::Html::Table {
> >     namespace export Merge
> >     namespace export Create
> > }
>
> > namespace eval ::Report::Html::Histogram {
> >     namespace export Create
> > }
>
> > proc ::Report::Html::Table::Merge {} { ... }
>
> > proc ::Report::Html::Table::Create {} { ... }
>
> > proc ::Report::Html::Histogram::Create {} { ... }
> > When I run pkg_mkIndex, I don't see any of the above in pkgIndex.tcl.
>
> What is it you believe you want to see in pkgIndex.tcl ?
>
> Be aware that the recommended practice changed from using -lazy to
> using -direct many years ago.  If you're insisting on sticking with
> -lazy indexing, be prepared to explain why.
>
> --
> | Don Porter          Mathematical and Computational Sciences Division |
> | donald.por...(a)nist.gov             Information Technology Laboratory |
> |http://math.nist.gov/~DPorter/                                 NIST |
> |______________________________________________________________________|- Hide quoted text -
>
> - Show quoted text -

If I rename one of the Create's to CreateUnique, I see this:

package ifneeded Report 1.0 [list tclPkgSetup $dir cama_Report 1.0
{{cama_Report.html.tcl source
{::Report::Html::Histogram::CreateUnique ::Report::Html::Table::Create ::Report::Html::Table::Merge}}}]

But I would like to see this:

package ifneeded Report 1.0 [list tclPkgSetup $dir cama_Report 1.0
{{cama_Report.html.tcl source
{::Report::Html::Histogram::Create ::Report::Html::Table::Create ::Report::Html::Table::Merge}}}]

Hm, I see. I was not aware of the -lazy and -direct distinctions;
indeed -direct would be my preference. However, I work in a corporate
environment and I am not able to change the infrastructure; we run Tcl
8.0.5 in all our server environments.

Would you explain why -lazy/-direct makes the difference in what I'm
doing? Thank you.
From: Don Porter on
Andrew Cheong wrote:
> On Aug 9, 2:09 pm, Don Porter <d...(a)nist.gov> wrote:
>> Andrew Cheong wrote:
>>> package provide Report 1.0
>>> namespace eval ::Report::Html::Table {
>>> namespace export Merge
>>> namespace export Create
>>> }
>>> namespace eval ::Report::Html::Histogram {
>>> namespace export Create
>>> }
>>> proc ::Report::Html::Table::Merge {} { ... }
>>> proc ::Report::Html::Table::Create {} { ... }
>>> proc ::Report::Html::Histogram::Create {} { ... }
>>> When I run pkg_mkIndex, I don't see any of the above in pkgIndex.tcl.

>> What is it you believe you want to see in pkgIndex.tcl ?

> If I rename one of the Create's to CreateUnique, I see this:
>
> package ifneeded Report 1.0 [list tclPkgSetup $dir cama_Report 1.0
> {{cama_Report.html.tcl source
> {::Report::Html::Histogram::CreateUnique ::Report::Html::Table::Create ::Report::Html::Table::Merge}}}]
>
> But I would like to see this:
>
> package ifneeded Report 1.0 [list tclPkgSetup $dir cama_Report 1.0
> {{cama_Report.html.tcl source
> {::Report::Html::Histogram::Create ::Report::Html::Table::Create ::Report::Html::Table::Merge}}}]

No. I assert what you really want to see as the contents of
pkgIndex.tcl is this:

package ifneeded Report 1.0 \
[list source [file join $dir cama_Report.html.tcl]]

Note that I've broken that onto two lines only to avoid wrapping
issues in Usenet. Single line in the actual file is fine.

Now surely you don't need a tool to create a single line file. So
forget standing on your head attempting to make [pkg_mkIndex] do
what you want (to say nothing of the 12-year-old version of
[pkg_mkIndex] you must be stuck with) and just create that one line
file.

> Hm, I see. I was not aware of the -lazy and -direct distinctions;
> indeed -direct would be my preference. However, I work in a corporate
> environment and I am not able to change the infrastructure; we run Tcl
> 8.0.5 in all our server environments.
>
> Would you explain why -lazy/-direct makes the difference in what I'm
> doing? Thank you.

The -lazy mode pointlessly conflates package indexing with the enabling
of autoloading.

Autoloading is extremely overrated, and better left completely undone
unless and until some measured need drives you to it. And in the
unlikely case such a need arises, autoloading ought to have an
implementation orthogonal to the package machinery.

The package machinery doesn't need to, and therefore should not, care
one whit what commands are provided by your package. All your troubles
are arising because in a moderately non-trivial case, [pkg_mkIndex]
is having trouble figuring out this thing it has no need to know.

[pkg_mkIndex] was a well-intentioned, but failed experiment. Drop it.
Create the pkgIndex.tcl files you need by other means.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter(a)nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
From: tom.rmadilo on
On Aug 9, 11:58 am, Don Porter <d...(a)nist.gov> wrote:

> Autoloading is extremely overrated, and better left completely undone
> unless and until some measured need drives you to it.  And in the
> unlikely case such a need arises, autoloading ought to have an
> implementation orthogonal to the package machinery.

Can this be the Quote of the Year? Maybe add it to a number of
manpages?