.
D 2012-05-20T17:39:53
J assignee msofer
J cmimetype text/plain
J comment Today,\sI\shave\sencountered\ssome\scurious\sdetails\sconcerning\sthe\s-map\sof\s[namespace\sensemble].\sThe\sfirst\sthing,\swhich\sis\squite\sreasonable\salthough\sa\ssurprise\sto\sme\sas\sit\sdoes\snot\sseem\sto\sbe\smentioned\sin\sthe\smanpage,\sis\sthat\sall\sprefixes\sin\sthe\s-map\soption\swill\sbe\smade\sfully\squalified\swhenever\sthey\sare\sset.\sThe\ssecond\sthing,\swhich\sseems\smore\squestionable,\sis\sthat\sthey\sare\salways\squalified\susing\sthe\scurrent\snamespace\srather\sthan\sthe\snamespace\sof\sthe\sensemble.\sThe\sfollowing\smodified\stest\sillustrates\smy\sexpectation\sand\sthe\scurrent\soutcome:\n\n\n====\snamespace-46.9\sensemble:\sconfiguring\sreally\sconfigures\sthings\sFAILED\n====\sContents\sof\stest\scase:\n\n\s\s\s\snamespace\seval\sns\s{\nnamespace\sensemble\screate\s-map\s{a\sa}\s-prefixes\s0\n\s\s\s\s}\n\s\s\s\sset\sresult\s[list\s[catch\s{ns\sx}\smsg]\s$msg]\n\s\s\s\slappend\sresult\s[namespace\sensemble\sconfigure\sns\s-map]\s;\s#\sAdded\n\s\s\s\snamespace\sensemble\sconfigure\sns\s-map\s{b\sb}\n\s\s\s\slappend\sresult\s[catch\s{ns\sx}\smsg]\s$msg\n\s\s\s\slappend\sresult\s[namespace\sensemble\sconfigure\sns\s-map]\s;\s#\sAdded\n\s\s\s\snamespace\sdelete\sns\n\s\s\s\sset\sresult\n\n----\sResult\swas:\n1\s{unknown\ssubcommand\s"x":\smust\sbe\sa}\s{a\s::ns::a}\s1\s{unknown\ssubcommand\s"x":\smust\sbe\sb}\s{b\s::b}\n----\sResult\sshould\shave\sbeen\s(exact\smatching):\n1\s{unknown\ssubcommand\s"x":\smust\sbe\sa}\s{a\s::ns::a}\s1\s{unknown\ssubcommand\s"x":\smust\sbe\sb}\s{b\s::ns::b}\n====\snamespace-46.9\sFAILED\n\nWhat\sseems\swacky\sto\sme\sis\sthat\sif\sI've\screated\san\sensemble\susing\sone\svalue\sfor\s-map,\sand\sthen\sreconfigure\sit\susing\sthe\sexact\ssame\svalue\sfor\s-map\s(or\sperhaps\smore\scommonly\ssome\sslight\sextension\sof\ssame),\sthen\sI\swill\sonly\sget\sthe\ssame\smapping\sof\scommands\sif\sI\salso\sissue\sthe\scall\sfrom\swithin\sthe\sexact\ssame\snamespace\sas\sI\sstarted\swith;\sI\swould\srather\sexpect\sthat\sthe\s-namespace\snamespace\sshould\sbe\sused,\sas\sit\sis\sfor\sresolving\s-subcommands\swithout\san\sexplicit\s-map\sentry.\n\nThat\ssaid,\sI'm\snot\ssure\sthat\sthe\sbehaviour\sis\snecessarily\suseless;\sI\scan\ssee\n\n\s\snamespace\sensemble\sconfigure\s$cmd\s-map\s[dict\smerge\s[namespace\sensemble\sconfigure\s$cmd\s-map]\s{\n\s\s\s\s\s\smore\s\smappings\n\s\s}]\n\nbeing\sa\spotentially\suseful\sidiom\sfor\sextending\san\sensemble\swith\scommands\sfrom\sa\sdifferent\snamespace\swithout\shaving\sto\sfully\squalify\sthem\sexplicitly,\sbut\swhether\sit\scould\sbe\sconsidered\sreliable\sbehaviour\sis\san\sopen\squestion:\sit's\snot\smentioned\sin\sthe\smanpage,\sand\sthere\sdoes\snot\sseem\sto\sbe\sany\stests\ssupporting\sthat\sthis\sis\sexpected\sbehaviour\seither.\n\nThe\spractical\scause\sof\sall\sthis\sseems\sto\sbe\sthat\sTclNamespaceEnsembleCmd\sgoes\n\n\s\s\s\sNamespace\s*nsPtr\s=\s(Namespace\s*)\sTclGetCurrentNamespace(interp);\n\n(tclEnsemble.c\sline\s111)\sand\stakes\sthis\sas\sspecifying\sthe\snamespace\sto\soperate\sin\salso\sfor\sthe\sENS_CONFIG\sbranch\sof\sthe\sfunction.\sThe\ssubsequent\scheck\s(lines\s117--124)\n\n\s\s\s\sif\s(nsPtr\s==\sNULL\s||\snsPtr->flags\s&\sNS_DYING)\s{\nif\s(!Tcl_InterpDeleted(interp))\s{\n\s\s\s\sTcl_AppendResult(interp,\n\s\s\s\s"tried\sto\smanipulate\sensemble\sof\sdeleted\snamespace",\n\s\s\s\sNULL);\n}\nreturn\sTCL_ERROR;\n\s\s\s\s}\n\ndoes\showever\sseem\sa\sbit\sout\sof\splace\sif\snsPtr\sis\salways\ssupposed\sto\srefer\sto\sthe\scurrent\sinterpreter\snamespace,\sso\sI'm\sinclined\sto\shypothesise\sthat\sthis\sarose\smore\sout\sof\saccident\sthan\sout\sof\sdesign.\n
J foundin obsolete:\s8.6b2
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter lars_h
J subsystem 21.\s[namespace]
J title ensemble\snamespace\swackiness
J type Bug
K 3528418fffffffffffffffffffffffffffffffff
U lars_h
Z 2bc93e655018ba8b6f412b2dc5b02ebe