Arjen Markus (17 september 2019) Last week there was a discussion about the math::geometry package in Tcllib on the comp.lang.tcl newsgroup. While partly about procedures that could be useful in addition to what it already contains, it was alao mentioned that a particular procedure was not exported. As the package contains a fairly large number of procedures, manually checking them is dull and error-prone (and goes against the grain of any lazy programmer). Hence the idea of letting the package speak for itself, using Tcl's introspection capabilities.
# chkexport.tcl -- # Check whether all relevant (?) procedures are also exported # source geometry.tcl #package require math::geometry namespace eval ::check { namespace import ::math::geometry::* set available [info proc *] } foreach proc [namespace eval ::math::geometry {info proc *}] { if { $proc ni $::check::available } { puts $proc } }
The method is very simple:
Of course, then you must decide if it is a public procedure or something that should only be used inside the package. I know of no method (beyond the convention of capitalised names and so on) of deciding that automatically. But the pacakge is not that large that that can't be done within a small amount of work.