On Tuesday, October 17, 2017 at 2:40:39 AM UTC-4, Christian Gollwitzer wrote:
>
> This should be easy to find out. Fire up an interpreter which can load
> the packages you need. Then "package ifneeded" tells you what it does
> when you load the package. For example:
>
> (Tests) 49 % package ifneeded Tk [package require Tk]
> load {} Tk
>
>
> Here, Tk is loaded using "load", which means it is a binary extension.
> In contrast,
>
> (Tests) 50 % package ifneeded fileutil [package require fileutil]
> source /Users/chris/bin/wish86/lib/tcllib1.18/fileutil/fileutil.tcl
>
Thank you all so very much for these tips. With my occasional interaction with Tcl, I am not up to speed on how loading and sourcing work internally. This has been a great introduction.
I combined a couple of the suggested ideas together and came up with a script that generates a simple report on what gets loaded and what gets sourced. I renamed the load and source commands, and I am using the "package ifneeded ..." command to load the packages. At each invocation, I print a line. It seems to work fine.
However, some packages surprised me. Consider md5:
PACKAGE: md5
SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/
md5-2.0.7.tm
Now, consider the weird output by md4: I doubt md4 requires such a weird collection of other packages. Perhaps it is searching everywhere to find it.
Is this normal?
PACKAGE: md4
SOURCE: -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.2/
md4-1.0.6.tm
SOURCE: C:/Tcl/lib/tk8.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Banking1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/base320.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/base32_hex0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/bench0.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/BWidget1.9.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/calendar0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/control0.1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl3.1.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_app3.1.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_class1.0.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/critcl_iassoc1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/ctext3.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/doctools1.4.19/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_flags1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_mini1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_mint1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/famfamfam_silk1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/ip1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Iwidgets4.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/java1.0.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/json1.3.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/logger_utils1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math1.2.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math_special0.3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/math_statistics1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/mentry_common3.7/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/mimetype1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/nettool0.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/Plotchart2.3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_cparam_configuration_critcl1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_cparam_configuration_tea0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_parse_peg1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pt_rde1.0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/snit2.3.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_graph2.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_queue1.4.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_set2.2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_stack1.5.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/struct_tree2.1.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tablelist_common5.13/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tar0.10/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tclcloud1.0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tclwinrm1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/tkpiechart6.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/treeql1.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/uid1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/wcb3.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/widget_listentry0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/widget_listsimple0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/tcl/lib/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/activestate_activetcl_demos8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Canvas3d1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_bmp0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_core0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pcx0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pfm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_pgm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_ppm0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_sgi0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_sun0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/crimp_tk0.1.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dbus-tcl1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dict8.5.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/DiffUtil0.3.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dom_c2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/dom_libxml22.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Expect5.43.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Ffidl0.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Garuda1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_base1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_bmp1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_dted1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_gif1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ico1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_jpeg1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_pcx1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_pixmap1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_png1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ppm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_ps1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_raw1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_sgi1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_sun1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_tga1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_tiff1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_window1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_xbm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/img_xpm1.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Itcl3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Itk3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/jpegtcl8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/lexec0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/linenoise1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Memchan2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Mk4tcl2.4.9.7.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/newclock1.0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Oratcl4.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/pngtcl1.4.12/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/ral0.10.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/rbc0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snack2.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snackogg1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snacksphere1.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/snodbc1.2.20080522/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sound2.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sqlite33.8.10.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/sqlite33.8.8.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/stext0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcc0.4.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclodbc2.5/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tclode1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TclOO1.0.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TclScript1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclspline1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tclx8.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tclyaml0.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcom3.9/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tdom0.8.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tensor4.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tifftcl3.9.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tile0.8.4.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tix8.4.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tkdnd2.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tkhtml3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/TkImageTools1.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tkpath0.3.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tktable2.11/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Tkzinc3.3.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tls1.6.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tls1.6.7.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tnc0.3.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Togl2.0/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/treectrl2.4.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/Trf2.1.4/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tth0.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/twapi3.0.32/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/udp1.0.11/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vfs1.4.2/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vfs_cookfs_c1.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/vu2.3/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/win321.1/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xml_c2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xml_expat2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/XOTcl1.6.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/xslt2.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/zlibtcl1.2.8/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/dde1.3/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/http1.0/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/opt0.4/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/reg1.2/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/tbcload1.7/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/thread2.7.2/pkgIndex.tcl
SOURCE: C:/Tcl/lib/tcl8.5/trofs0.4.6/pkgIndex.tcl
SOURCE: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/critcl-rt.tcl
LOAD: c:/Tcl/lib/teapot/package/win32-ix86/lib/tcllibc0.3.14/win32-ix86/tcllibc.dll Tcllibc