Skip to content
Tcl Source Code Artifact [e218630a2a]
Login

Artifact [e218630a2a]

Artifact e218630a2a49589948921ef0393ff33e8d2ed0b5:

Ticket change [e218630a2a] - New ticket [218025ffffffffff|218025ffff] <i>namespace export must be in the file defining the proc...</i>. by nobody on 2000-10-26 00:52:18.
D 2000-10-26T00:52:18
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1187\sBug\nVersion:\s8.0.4\nSubmitDate:\s'1999-02-11'\nLastModified:\s'2000-02-02'\nSeverity:\sMED\nStatus:\sClosed\nSubmitter:\spat\nChangedBy:\sericm\nRelatedBugIDs:\s1115\nOS:\sAll\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-02-02'\n\n\nName:\sJim\sIngham\n\nReproducibleScript:\nMake\stwo\sfiles:\n\nfoo.tcl:\nnamespace\seval\sfoo\s{\n\s\s\s\snamespace\sexport\sbar\sdada\n\s\s\s\sproc\sbar\s{}\s{puts\s"I\sam\shere"}\n}\n\ndada.tcl:\nnamespace\seval\sfoo\s{\n\s\s\s\sproc\sdada\s{}\s{puts\s"Me\stoo!"}\n}\n\nNow,\smake\sa\stclIndex\sfile\sfor\sthese\stwo\sfiles,\sand\sthen\sdo:\n\n$\stclsh8.0\n%\slappend\sauto_path\s[pwd]\n/home/jingham/install/lib/tcl8.0\s/home/jingham/install/lib\s/tmp\n%\snamespace\simport\sfoo::dada\n%\sdada\ninvalid\scommand\sname\s"dada"\n%\s\n\nObservedBehavior:\nThe\scommand\sdada\sshould\sbe\simported.\s\sAfter\sall,\sit\sIS\son\sthe\sexport\slist...\n\nDesiredBehavior:\ninvoking\sdada\sshould\sprint\sout\n\nMe\stoo!\n\nThis\sis\slike\sthe\s"namespace\simport\sis\sbroken\sin\sItcl3.0.1"\sbug,\sthough\s\nadmittedly\smore\scontrived.\s\sThe\sproblem\sis\sthat\snamespace\simport\suses\sthe\s\nauto_index\sto\sdetermine\swhat\sfiles\sit\sshould\ssource\swhen\sdoing\sthe\s\nauto_loading\sof\scommands.\s\sTo\swork\scorrectly,\sit\salso\sneeds\sto\sknow\swhat\s\nthe\sexport\slist\sfor\sthe\smodule\swas.\n\nI\squoted\sa\ssemi-bogus\sstab\sat\sgetting\sthis\sto\swork\sin\sthe\sItcl\sbug\sreport.\nThe\sidea\sis\sthat\sthe\sexport\slist\sfor\snamespaces\sneeds\sto\sget\srecorded\sin\nthe\stclIndex\sfile\sas\swell\sas\sthe\slist\sof\scommands.\n\nThis\sis\snot\sa\sbig\sdeal,\ssince\speople\sprobably\stend\sto\sput\sall\sthe\scode\sfor\none\snamespace\sin\sa\ssingle\sfile,\sor\sthey\sjust\sblanket\simport\sall\sthe\sexported\nfunctions\susing\n\nnamespace\simport\sfoo::*\n\nIn\seither\scase,\severything\swill\swork\sfine.\s\sBut\sthe\sbug\sis\sthere\snonetheless...\n\n\n05/09/1999\s23:01\s-\sfoster\s-\sper\sBrent,\ssuspects\sfixed\sin\s8.1.\n--\nThis\swasn't\sfixed\sper\sse\sin\s8.1,\sbut\sI\sthink\sthat\sthis\sis\snot\na\scorrect\sassumption\sto\smake\sof\sthe\sauto_load\smechanism.\nCalling\sdada,\sor\sdoing\sthe\snamespace\simport\swill\snot\scause\nthe\sfile\sthat\shas\sbeen\sauto-indexed\sto\sbe\ssourced.\s\sThe\suser\nshould\sinstead\sconsider\smaking\sa\spackage\swith\s-direct,\sand\ndoing\spackage\srequire.\s\n--\s12/03/1999\shobbs\nOf\scourse,\sthat\sdoesn't\ssolve\sthe\sentire\sproblem.\s\sThe\sreal\nquestion\sis\show\sto\shandle\sthe\scase:\n\s\s\s\spackage\srequire\sIwidgets\n\s\s\s\snamespace\simport\s::iwidgets::*\nCan\sit\sbe\sdone\swith\slazy\sloading,\sor\sare\swe\sstuck\swith\sslower\nload\stimes?\s\n--\s12/06/1999\shobbs\n\nYes,\snamespace\simport\s*does*\scause\sthe\sauto\sindex'ed\sfile\sto\sbe\sloaded.\s\sHowever,\sI\sthink\sit\sis\sreasonable\sto\ssay\sthat\sthis\sis\snot\show\sauto\sindexing\sis\smeant\sto\sbe\sused;\sif\syou\shave\sa\smulti-file\spackage,\syou\sshould\suse\spackage.\s\sIn\sthat\scase,\syou\sshould\sfollow\sthe\smodel\sused\sby\sIwidgets,\swhich\shas\sa\smain\spackage\sfile\sthat\sis\sdirectly\sloaded\son\spackage\srequire,\sand\ssub-files\sthat\sare\sauto\sloaded\sas\sneeded.\s\sIf\syou\sdo\snamespace\simport\s::iwidgets::*,\sthat\swill\scause\severything\sto\sbe\sloaded,\sbut\sI\sdon't\sthink\sthat's\sunreasonable.\s\sI\sdon't\sthink\sthere\sis\sreally\san\sissue\shere\sanymore,\sso\slong\sas\swe\shave\sthe\sunderstanding\sthat\sauto\sindexing\sis\sfor\svery\ssimple\spackages\sonly,\sand\sanything\smore\scomplex\sshould\suse\sthe\spackage\smechanism.\n\nJim,\sif\syou\sthink\sthere\sis\sstill\san\sissue,\splease\srespond.\n\n-\seric\n\n--\s02/01/2000\sericm\n\nFrom\sBrent:\n\nHere\sis\swhat\sI\sdid\sat\sone\spoint.\nThere\sis\sa\snamespace\scommand\semulation\sin\sauto.tcl,\sright?\nI\sadded\sa\sbit\sof\scode\sto\spay\sattention\sto\sthe\s"namespace\sexport"\scommand,\nbasically\sremember\sthe\sexport\spattern\sfor\sa\sparticular\sfile.\nI\sbelieve\sI\sinvented\san\s"auto_export"\sarray\sindexed\sby\s?filename?\nThen,\sinside\sauto_import,\sI\swas\ssomehow\sable\sto\screate\sa\slist\sof\nthe\sprocedures\sthat\swould\sbe\sdefined\sif\sI\swere\sto\ssource\sa\sfile,\nall\swithout\sactually\ssourcing\sit.\s\sThis\sachieves\sa\stwo-level\sscheme\nwhere\sauto_import,\swhich\sis\scalled\sin\sresponse\sto\s\nnamespace\simport\siwidgets::*\nsets\sup\sthe\sauto_index\sarray\sfor\sall\sthe\siwidgets\scommands.\n\nPonder\sthis,\sthen\sI'll\sdrop\sby\sand\sperahps\swe\scan\srecreate\sthe\sscenario\nmore\sfully.\n\nAlso,\sas\sto\sthe\soriginal\sissue\sof\shaving\sa\snamespace\sspread\sacross\nmultiple\sfiles,\swhy\scan't\swe\slegislate\sthat\severy\sone\sof\sthose\sfiles\nhas\sa\snamespace\sexport\scommand\sin\sit?\s\sIn\sfact,\sI\sthink\sit\sis\snecessary\nfor\sthe\sabove\sscheme.\n\n--\s02/02/2000\sericm\n\nFrom\sJim:\n\n\s>\s\n\s>\sOn\sTue,\s1\sFeb\s2000,\sJames\sIngham\swrote:\n\s>\s\n\s>\s>\sWell...\s\sI\sam\snot\ssure\sit\sis\sdesirable\sto\ssource\sin\sa\swhole\spackage\sin\n\s>\s>\sorder\sto\sdo\snamespace\simport\siwidgets::*.\s\sOver\sthe\slong\sterm,\sthis\n\s>\s>\swill\smean\sthat\sbig\spackages\sare\sa\sreal\spain.\s\sIt\smight\sbe\sokay\sto\n\s>\s>\sforce\sthe\spackage\sto\sbe\sbroken\sup,\sbut\sif\sI\shave\sto\ssource\sin\sALL\sthe\n\s>\s>\sIwidgets\scode\sjust\sto\suse\sa\scouple\sof\smegawidgets,\sthen\sit\swill\sgive\n\s>\s>\sme\smore\spause\sabout\swhether\sI\swant\sto\suse\sit\sor\snot.\s\sIt\sdoes\scause\sa\n\s>\s>\snoticable\shit\sto\sthe\sstartup\stime.\n\s>\s\n\s>\sAgreed,\sbut\sif\syou\sare\snot\susing\sall\sof\sthe\swidgets,\swhy\snamespace\simport\n\s>\siwidgets::*?\s\sYou\scould\simport\sjust\sthose\scommands\sthat\syou\sneed,\sand\sthus\n\s>\savoid\ssourcing\sthe\swhole\spackage.\s\sIwidgets\sis\salready\sbroken\sup\sinto\sits\n\s>\scomponent\spieces,\sand\sI\sthink\sit's\sreasonable\sto\sthink\sthat\sany\n\s>\ssufficiently\slarge\spackage\swill\sbe\ssimilarly\ssplit.\nI\swould\slike\sto\sstructure\smy\sprogram\sso\sthat\sI\sdo\sall\smy\spackage\nrequires\sand\simports\sin\sthe\sstartup\scode.\s\sImporting\sthe\siwidget\ncommands\sbit\sby\sbit\smeans\sthat\sI\shave\sto\skeep\sadding\sstatements\sto\nthis\sfile\severy\stime\sI\sdecide,\sin\ssome\swholly\sother\sbit\sof\scode,\sthat\nI\swant\sto\suse\sa\snew\sbit\sof\sthe\sIwidgets.\s\sThis\sis\sa\spain\sin\sthe\sneck.\n\n\s>\s\n\s>\s>\sSo\sthe\soverall\sissue\sis\ssort\sof\smoot,\sbut\sa\sreal\ssolution\sto\snamespace\s\n\s>\s>\simporting\sa\spackage\swhich\sconsists\sof\smultiple\sfiles,\shas\snot,\sto\smy\n\s>\s>\smind,\sbeen\sadequately\ssolved.\n\s>\s\n\s>\sProbably\strue.\s\sOne\sidea\sthat\scomes\sto\smind\sis\sto\schange\sthe\sbehavior\sof\n\s>\snamespace\simport\sto\s(essentially)\slazily\ssource\sthe\sfiles,\srather\sthan\n\s>\sforcing\san\simmediate\sload.\s\sThis\srequires\ssome\sserious\schanges\sto\sthe\sauto\n\s>\sindexer\sand\sthe\sentire\scommand\sinfrastructure,\sso\sI\sdon't\srealistically\n\s>\ssee\ssomething\slike\sit\shappening\sany\stime\ssoon.\nActually,\sthere\sis\scode\sin\sIncrTcl\sto\sdo\sjust\sthis\s(it\sjust\sdeals\swith\s\nnamespaces,\sand\sis\snot\sIncrTcl\sspecific).\s\sLook\sat\sthe\sauto_import\nfunction\sdefined\sin\sitcl.tcl,\sand\sthe\sItcl_Stub{Create,Exists}Cmd\nfunctions\sin\sitcl_cmds.c.\n\nThe\sproblem\sis\sthat\sthese\scommands\sdon't\swork\sbecause\sof\nbugs/shortcomings\sin\show\sthe\simport\smechanism\sworks.\s\sBasically,\sthere\nis\sno\srecord\sof\sthe\sexport\slist\sfor\sa\snamespace\sother\sthan\sthe\sexport\ncommands\sin\sthe\ssource\sfiles.\s\sThis\smeans\sthat\sin\sorder\sto\sknow\swhat\ncommands\smatch\sa\scertain\simport\spattern\s(remember\sthe\smatch\sis\sonly\nagainst\scommands\sin\sthe\sexport\slist),\syou\shave\sto\ssource\sin\sall\sthe\nsource\sfiles.\n\nBrent\s&\sI\sworked\sup\sa\sfix\swhere\sthe\sauto_mkindex\sprocess\swould\salso\nrecord\sthe\snamespace\sexports,\sso\syou\scould\sadd\sthe\sexport\slist\sto\sthe\ntclIndex\sfile.\s\sThis\sway\syou\swould\shave\sall\syou\sneeded\sfrom\sthe\ntclIndex\sfile,\sand\swould\snot\sneed\sto\speek\sin\sthe\ssource\sfiles.\s\sBrent\nnever\sfinished\sthis\swork\soff,\showever,\sand\sI\salso\sgot\stoo\sbusy.\s\sThere\nis\snot\sthat\smuch\swork\sneeded\sto\ssolve\sthe\sproblem\scorrectly,\sbut\nunfortunately\sit\sis\smore\sthan\sI\shave\stime\sfor.\n\nIf\syou\sare\sstill\scurious,\syou\scan\sask\sBrent\sfor\ssome\smore\sdetails.\s\sHe\s\neven\ssent\sme\ssome\spatches\sthat\salmost\swork\sin\san\semail\sabout\sa\syear\nago.\s\sHe\smight\sbe\sable\sto\sdig\sthem\sup\sfor\syou.\n\nJim\n\n--\s02/02/2000\sericm\n\n
J foundin obsolete:\s8.0.4
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 56.\sLibTomMath
J title namespace\sexport\smust\sbe\sin\sthe\sfile\sdefining\sthe\sproc...
J type Bug
K 218025ffffffffffffffffffffffffffffffffff
U nobody
Z 5bd85a513cac7e7d2b4ef306991ce18a