.
D 2002-10-18T08:41:35
J assignee msofer
J cmimetype text/plain
J comment Snipped\sfrom\san\semail\ssent\sto\sMiguel,\srepeated\shere\sfor\spersistence...\n\nI\sworry\sabout\sshimmering\sa\slot.\s\sOne\sthat\sreally\sannoys\sme\sis\screating\sstrings\sfrom\sints.\s\sNot\seven\slosing\sthe\sinternal\srepresentation,\sbut\ssimply\sthe\sfact\sof\shaving\sto\sturn\san\sint\sinto\sa\sstring\sto\sbe\susable\sin\scontexts\slike:\nif\s{$a\seq\s""}\s{\s...\s}\nOr\sin\sthe\scase\sI\sneed\snow:\nif\s{$a\seq\s"#"}\s{\s...\s}\n\nThe\spoint\sbeing\sthat\ssince\sneither\sof\sthe\sabove\sis\sa\spossible\sint,\sthere\sis\snot\seven\sa\spoint\sin\sforcing\san\sint-to-string\sconversion\sto\sperform\sthe\scomparison.\s\sIn\sother\swords:\sone\soperand\sis\sof\stype\sX,\swhile\sthe\sother\sis\sconstant\sand\snot\spossibly\sconvertible\sto\stype\sX.\n\nIt\smay\sseem\slike\sa\svery\sspecial\scase,\sbut\sin\swhat\sI'm\sdoing\sints\smatter\sa\slot\s-\sas\sloopign\sconstruct\siterators,\sand\slist/vector\sindices.\n\nHere's\sa\smore\scommon\sexample,\sin\stoday's\sTcl\sworld,\sI\ssuppose:\nif\s{$a\seq\s"end"}\s{\s...\s}\n\nThe\spoint\sis\sthat\sit\swould\sbe\snice\sas\soptimization\sto\sdecide\sthat\sthings\scannot\spossibly\smatch,\swithout\snecessarily\sbringing\sthem\sinto\sthe\ssame\stype,\snot\seven\sboth\sas\sstrings.\n\nMuch\sfurther\sdown\sthe\sline,\sperhaps\s9.0\stimeframe,\sone\scould\sconsider\sadding\san\sextra\smember\sto\sthe\sexisting\s4\sdispatch\sfunctions\sof\seach\stype,\sbeing\sa\sfunction\swhich\stakes\san\sobject,\sand\sreturns\sfalse\s*QUICKLY*\sif\sthe\sgiven\sobject\sis\smost\scertainly\snot\sconvertible\sto\sthat\stype.\s\sIt\smight\seven\sbe\sgeneralized\sto\sstrings\s-\smeaning\san\sobject\shas\sno\sstring\srep\sand\shence\smust\sbe\streated\sas\sprecious\s(and\snon-writable,\snon\spersistable,\setc).\s\sIt\sis\sthen\sup\sto\seach\stype\sto\simplement\sas\ssophisticated\schecks\sas\sit\slikes\s-\si.e.\sthe\sint\stype\scould\sreject\sobjects\swhich\shave\sa\sstring\srep\sright\snow,\sbut\swhich\sdo\snot\sstart\swith\s+-0--9.\s\sBut\sthat's\sjust\sa\sstart\s-\sit\scould\salso\sreject\slist\sobjects\sif\stheir\ssize\sis\sanything\sbut\sone\selement.\s\sBoth\schecks\sare\sreally\scheap.\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter jcw
J subsystem 47.\sBytecode\sCompiler
J title more\sways\sto\savoid\sshimmering
J type RFE
K 625103ffffffffffffffffffffffffffffffffff
U jcw
Z 238e4cde07446d1e40cd21cef377dfad