From: tom.rmadilo on 4 Jan 2010 13:25 On Jan 3, 3:02 pm, Will Duquette <w...(a)wjduquette.com> wrote: > On Jan 3, 11:04 am, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > > It sounds to me like you have a two level package loader, which is > > what I have as well. The built-in Tcl package loader is great for > > library code, but it can't handle local configuration before and after > > loading the library code. This is handled by my specialized loader. > > Some code also needs initialization, which must occur in the correct > > sequence. My loader also records the actual files sourced, which helps > > track down errors. The Tcl package loader provides no means to record > > this information, and requires you to deal with errors generated in > > end user code. > > Not as such--the "loader" script I talk about simply determines where > the application's lib directory is, prepends it to the auto_path, and > requires the application package. I'm not changing the default > packing loading mechanism at all. I said "two level" package loader: one level is the standard package loading built into Tcl, the other is your three step fix-up prior to this. Believe it or not, your package loader does more than mine, since I just use a list of package keys and loop over a set of files to source based upon this key. Adding a new "package" requires adding one key to a list (in the correct place, usually at the end). > I'm not sure what you mean by "local configuration". Local configuration: load a database module, you need to supply local configuration information to connect to a particular database. Or, local configuration could simply mean running the package init script (almost all my packages have init scripts in order to minimize [namespace eval] code in library files). One hole in this setup, which I'm working to correct is to move all local configuration and just include the library code and init script. The local configuration code will move to a parallel set of directories for code development purposes and move into place during installation. This will make it easier to check in code changes while ignoring local configuration changes. |