<i>more (compiled) lreplace madness</i> status still Open with 3 other changes
by
.
D 2015-06-22T07:41:25.572
J icomment <p>It\slooks\sto\sme\slike\scompiled\slreplace\sas\scurrently\simplemented\s<i>cannot</i>\scorrectly\sdeal\swith\sindexes\sof\sdiffering\ssign\s(ie,\sone\sis\san\send-based\sindex).\r\n\r\n<p><a\shref="http://core.tcl.tk/tcl/artifact/987b59004f8ac6da?ln=1592-1598">here</a>\sis\sthe\scode\sresponsible\sfor\sthe\s"dropRange"\scase.\s\sIt\scompiles\sas\sthe\sequivalent\sof:\r\n\r\n<pre>concat\s[lrange\s$l\s0\s$idx1-1]\s[lrange\s$l\s$idx2+1\send]</pre>\r\n\r\n<p>which\sis\sfine\sin\sordinary\scases,\sbut\sfails\swhen\sone\sof\sthe\sindices\sis\s<tt>end</tt>-based\sand\s<tt>$idx2\s<\s$idx1</tt>.\r\n\r\n<p>To\sfix\sthis,\scompiled\s<tt>lreplace</tt>\sneeds\sto\sbe\ssensitive\sto\sthe\slength\sof\sthe\slist\sit\sis\sexamining.\s\sSimplest\sis\sprobably\sto\semit\sbytecode\sfor\s<tt>end</tt>-based\sindexes\sthat\sdoes\sthe\sarithmetic\sto\smake\sthem\spositive.\r\n\r\n<p>Since\sthat\shas\sto\sbe\scomputed\son\sthe\sstack,\sand\s<tt>INST_LIST_RANGE_IMM</tt>\sseems\sto\sneed\sits\sarguments\sas\simmediates,\sI\sneed\sadvice\son\swhat\sbytecode\sinstructions\sshould\sbe\sused\sin\sthis\scase.
J login aspect
J mimetype text/html
K 47ac84309bab4719c58a693f5d63d837887f3b17
U aspect
Z 1b1cdd8858707d7a50dd88564be9ac70