Skip to content
Tcl Source Code Artifact [25f2c8680a]
Login

Artifact [25f2c8680a]

Artifact 25f2c8680a65e732448e1c74d985eb9993d98196:

Ticket change [25f2c8680a] - New ticket [871387ffffffffff|871387ffff] <i>dict exists throws unexpected error</i>. by mic42 on 2004-01-06 02:22:24.
D 2004-01-06T02:22:24
J assignee dkf
J cmimetype text/plain
J comment The\sdict\sexists\ssubcommand\sshows\sa\sbehaviour\sthat\sis\nnot\sclearly\sdocumented\sbut\sunexpected,\sso\seither\sthis\nis\sa\sdocumentation\sbug\sor\sa\smisfeature/real\sbug.\n\nI\stried\sto\supdate\smsgcat.tcl\sto\sdicts\sand\sstumbled\naccross\sthe\sfollowing:\n\nset\sMsgs\s[dict\screate]\n#\screate\sa\ssubdict\sfor\sa\slocale\ndict\sset\sMsgs\sde\s[dict\screate]\n#\screate\sa\ssubdict\sfor\sa\snamespace\ndict\sset\sMsgs\sde\s""\s[dict\screate]\n#\screate\san\sentry\sthere\ndict\sset\sMsgs\sde\s""\shello\sHallo\n\n#\scheck\sif\sa\stranslation\sexists\ndict\sexists\s$Msgs\sfr\s""\shello\n\nThis\sthrows\san\serror\sif\sthe\ssubdict\sfr\sand\sfr\s""\sdoes\nnot\sexist.\sI\swould\sexpect\sit\sto\ssimply\sreturn\s0.\s\n\nIt\swould\sbe\sbetter\sif\sit\ssimply\sreturned\s0,\sas\sthere\sis\nno\sgood\s(and\sfast)\sworkaround.\n\nThe\sonly\salternatives\sare:\n\nset\sok\s0\nset\spath\s""\nforeach\skey\s{fr\s""\shello}\s{\n\s\s\slappend\spath\s$key\s\n\s\s\sif\s{[dict\sexists\s$Msgs\s{expand}$path]}\s{\n\s\s\s\s\s\s\s\sset\sok\s1\n\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\sbreak\n\s\s\s}\n}\n\nor:\n\nif\s{[catch\s{dict\sexists\s$Msgs\sfr\s""\shello}\sval]}\s{\s...\s}\n\nAs\si\sthink\sa\scheck\sfor\selement\sexistance\sis\sa\scommon\noperation\sit\sshould\snot\sneed\ssuch\scomplex\sworkarounds\nto\sbe\suseful\sfor\snested\sdicts.\n\nThe\scurrent\sbehaviour\swould\sbe\smore\sappropriate\sfor\nsomething\slike\sa\sdict\sexists\s-strict\scommand\svariant.\n\nMichael\n\n\n\n\n\n
J foundin obsolete:\s8.5a0
J priority 5\sMedium
J resolution None
J status Open
J submitter mic42
J subsystem 15.\sDict\sObject
J title dict\sexists\sthrows\sunexpected\serror
J type Bug
K 871387ffffffffffffffffffffffffffffffffff
U mic42
Z 88f13d54b015560adbbd48fc37bc286f