Posted to tcl by Stu at Mon Sep 26 09:19:11 GMT 2022view pretty

# This works but not when called from any namespace
namespace eval config {
proc config {args} {
        variable conf
        namespace path [namespace parent]
        set me [namespace tail [lindex [info level 0] 0]]
        namespace ensemble create -prefixes no -command $me -map [dict create \
                open      openConfig \
                save      configSave \
                savelater configDelayedSave \
                autoload  autoloadConfig \
        ]
        rename $me _$me
        set conf(cfgNS) [namespace current]
        tailcall $me {*}$args
}
}