|
2016-04-17
| ||
| 01:14 | • Closed ticket [44fd4b9a4e]: More lreplace weirdness plus 7 other changes artifact: 6e3a0e9f96 user: anonymous | |
|
2015-08-30
| ||
| 20:25 | • Ticket [44fd4b9a4e]: 3 changes artifact: ff0043cdac user: dkf | |
|
2015-06-22
| ||
| 17:03 | • Ticket [44fd4b9a4e]: 3 changes artifact: 6a31430610 user: ferrieux | |
| 15:39 | • Ticket [47ac84309b] more (compiled) lreplace madness status still Open with ... artifact: eafccc8183 user: oehhar | |
| 06:32 | • Ticket [44fd4b9a4e] More lreplace weirdness status still Open with 3 other c... artifact: b06258ac58 user: aspect | |
| 04:56 | • Ticket [44fd4b9a4e]: 3 changes artifact: c81803fcdc user: aspect | |
| 03:28 | • Ticket [44fd4b9a4e]: 3 changes artifact: 553f84ef86 user: aspect | |
|
2015-06-21
| ||
| 21:21 | • Ticket [44fd4b9a4e]: 3 changes artifact: 6db31a5489 user: ferrieux | |
| 21:01 | • Ticket [44fd4b9a4e]: 3 changes artifact: 0691857030 user: ferrieux | |
| 19:35 | • New ticket [44fd4b9a4e]. artifact: 18fa2d222d user: sbron | |
More lreplace weirdness
% lreplace a 1 end a % set x 1; lreplace a $x end list doesn't contain element 1
eafccc8183Ticket [47ac84309b] more (compiled) lreplace madness status still Open with 5 other changes ticket2015-06-22 15:39:32
Seems to be a day-one bug of the compiled version of lreplace in [e3106247db]
Also, looking at the complexity of the code, I'm wondering whether it's wise to invest so much to optimize such corner cases. I don't find it too demanding to ask a sensible person to use [lrange] instead of [lreplace .. end].
Looks like this one is triggering in the *non-compiled* version of lreplace. Ferrieux, am I not seeing an important connection to [e3106247db]?
this seems to be the test that is breaking down. I need more caffeine and crayons before attacking it confident I'm not going to make things worse.
According to kbk on the chat, lreplace a 1 end should Do Nothing Gracefully. lreplace a 2 end should error as it's asking to leave a nonexistent element.
There seem to be more problems ([47ac84309b]) with compiled lreplace clouding the issue. Ugh.
lreplace.n does not support the theory that 1-past-the-end is a valid index for lreplace:
"For non-empty lists, the element indicated by first must exist or first must indicate before the start of the list."
The interpreted implementation (referenced in this ticket) agrees with the manual. The compiled version (inconsistently) currently does not - presumably so that end+1 can be used to append.
Before proceeding to fix both these tickets, I think we should agree on whether end+1 indexes should be allowed for lreplace, and if so, start by crafting a clear description for the manual.
Further unusual behaviour I don't understand (error suppression for the empty list) is described at http://paste.tclers.tk/3547. Anyone know why that behaviour exists? Do we want it?
My earlier remark on the compiled version being "buggy" is, of course, relative to the documented behavior ("first must exist").
Now since you're suggesting to make slightly incompatible, but extremely reasonable updates to the documented semantics: yes, I agree that one single rule should define allowed positions in [lreplace]: make sure that the target range "touches" the input list.
This allows for
lreplace a 1 end
lreplace {} 0 end
and precludes
lreplace a 2 end
lreplace {} 1 end
So I'm okay if your plan is to update the noncompiled semantics as just described.
As to the compiled version, again, I'd suggest to drastically reduce the ambition of the optimizer (especially the handling of the lrange-equivalent cases known at compile time, since there's no demand).
This was fixed with [47ac84309b] in [d561a9353]. The resolution makes behaviour uniform on empty lists, resolving everything raised in this ticket.