Skip to content
Tcl Source Code Artifact [b815a1e33e]
Login

Artifact [b815a1e33e]

Artifact b815a1e33e99451c399154e17a0e8cb608784e26d16e2bd3dccc2a93dbf39a99:

Ticket change [b815a1e33e] - Pending ticket [a998df01f3256f79|a998df01f3]: <i>Attempt to load platform package in a pkgIndex.tcl generates circular dependency error</i> plus 5 other changes by jan.nijtmans on 2022-07-04 19:09:05.
D 2022-07-04T19:09:05.239
J assignee jan.nijtmans
J icomment Well\s-\sfirst\s-\sif\s'testpkg'\sneeds\s'platform',\s`the\scorrect`\sway\sto\sdo\sthis\sis\sas\sfollows:\r\n<pre>\r\n##########\spkgIndex.tcl\s########\r\npackage\sifneeded\stestpkg\s0.1\s[list\ssource\s[file\sjoin\s$dir\stestpkg.tcl]]\r\n\r\n##########\stestpkg.tcl\s########\r\npackage\srequire\splatform;\s#\s<--\sshould\sbe\shere,\snot\sin\spkgIndex.tcl\r\nproc\stestproc\s{}\s{puts\s"testpkg\sloaded"}\r\npackage\sprovide\stestpkg\s0.1\r\n</pre>\r\n\r\nThe\spkgIndex\ssystem\sis\scomplex.\sIf\sa\spackage\sis\snot\sfound\swhen\sdoing\sa\s"package\srequire",\smore\sfile\spaths\sare\ssearched\sfor\sa\s'pkgIndex'\sfile.\sTherefore,\sa\s'pkgIndex'\sfile\sshould\sonly\scontain\scommands\swhich\shave\sno\sside-effects,\sit\sshould\sNEVER\sdo\sanother\s'package\srequire'\sdirectly\sor\sa\s'load'.\s'pkgIndex'\sfiles\sshould\shardly\sdo\sanything\smore\sthan\s'package\sifneeded'.\r\n\r\nThe\sreason\sTcl\s8.7\sdiscovers\sthis\sand\s8.6\sdoesn't\sis\s[https://core.tcl-lang.org/tips/doc/trunk/tip/459.md|TIP\s#459].\sTcl\s8.7\skeeps\strack,\swhich\sfiles\sare\ssourced\sin\swhich\spackage\sinitialization,\sso\s'package\sfiles'\scan\sreport\sit.\sMaybe\sthe\serror-message\scould\sbe\sbetter\s.....\r\n\r\nDoes\sthis\sexplanation\smake\sit\sa\slittle\sbit\smore\sclear?
J login jan.nijtmans
J mimetype text/x-fossil-wiki
J resolution Invalid
J status Pending
K a998df01f3256f79f4d7d635517130012b4001f5
U jan.nijtmans
Z 2cb47632c25add1a02f9b9ed5a18ae52