|
2024-11-14
| ||
| 10:34 | • Ticket [214cc0eb22] lappend no-op function changes when compiled status stil... artifact: a98ecec75b user: jan.nijtmans | |
|
2024-09-20
| ||
| 20:38 | • Ticket [e38dce74e2] Command line built with list not properly quoted status ... artifact: 4c2a7cc393 user: sebres | |
| 20:25 | fix for [e38dce74e2] also for lappend etc (another variant to fix inconosistce of [214cc0eb22]); mor... check-in: 3d1a4c2dde user: sebres tags: bug-e38dce74e2-214cc0eb22-v2 | |
|
2014-11-08
| ||
| 07:07 | • Closed ticket [214cc0eb22]: lappend no-op function changes when compiled plu... artifact: e53bf9aa1c user: dkf | |
| 07:06 | [214cc0eb22] Add tests to make sure that this bug stays fixed. check-in: fcc112066f user: dkf tags: trunk | |
|
2014-11-07
| ||
| 15:56 | • Ticket [214cc0eb22] lappend no-op function changes when compiled status stil... artifact: 438cbe91f8 user: dkf | |
|
2014-11-05
| ||
| 06:38 | • Ticket [214cc0eb22]: 3 changes artifact: 303c766bb1 user: dgp | |
| 06:36 | [214cc0eb22] Restore [lappend $var] return value to the 8.6.1- behavior. If this is going to change,... check-in: f40e585e4b user: dgp tags: trunk | |
| 05:39 | • Ticket [214cc0eb22] lappend no-op function changes when compiled status stil... artifact: 530f82d6a2 user: dgp | |
|
2014-11-04
| ||
| 23:48 | • New ticket [214cc0eb22]. artifact: 3bb39bb64c user: dgp | |
lappend no-op function changes when compiled
Pointed out on comp.lang.tcl:
> % set str {# 1 2 3}
> # 1 2 3
> % lappend str
> {#} 1 2 3
>
> % set str {# 1 2 3}
> # 1 2 3
> % [subst lappend] str
> # 1 2 3
The lappend command ought to behave the same whether
bytecode compiled or not.
The bytecode compiled behavior is what's new and creating
the inconsistency.
4c2a7cc393Ticket [e38dce74e2] Command line built with list not properly quoted status still Open with 3 other changes ticket2024-09-20 20:38:013d1a4c2ddefix for [e38dce74e2] also for lappend etc (another variant to fix inconosistce of [214cc0eb22]); more coverage for that (all commands must behave the same way) check-in2024-09-20 20:25:51fcc112066f[214cc0eb22] Add tests to make sure that this bug stays fixed. check-in2014-11-08 07:06:52f40e585e4b[214cc0eb22] Restore [lappend $var] return value to the 8.6.1- behavior. If this is going to change, lets not do it by accident. check-in2014-11-05 06:36:07
Introduced in http://core.tcl.tk/tcl/info/17150b71d2
Simplest possible fix committed to trunk: disable compile of the
inconsistent case.
Leaving open in case dkf wants to pursue actually patching up
the behavior of all the new bytecode instructions instead.
There's a natural question to be asked here about whether
[lappend] ought to be always producing canonical lists. It has
not been doing so up to now. The argument in favor is to
expand the set of commands one can use to create commands
for evaluation with complete confidence.
set script "a\nb"
eval [lappend script {*}$args] ;# one command or two?!
The argument against is that a no-op is best implemented as
a no-op (but in that case, why are we checking for list-ness?).
In particular, here a variable is involved and given the chance
to leave a variable's contents untouched, we should (and avoid
triggering traces, etc.).
I don't think either case is completely convincing to me, leaving
me uncertain which is more properly the best behavior to choose.
In that situation I break the tie by keeping consistency with
the historical practice.
Other opinions are invited. In particular examples of existing
use of [lappend] to produce scripts for evaluation would be
good to know about, in particular, those combined with {*}
that might degenerate to the troublesome case.
No, that's the right fix. The form lappend somevar is very strange in that it creates the variable if necessary, checks that value it contains is a well-formed list, yet doesn't otherwise modify the variable. Given how much of an evil edge case this is, I'm just going to leave it to the interpreted version; fixing things will require doing changes to the semantics of lappend (i.e., not Tcl 8.6).
Expansion isn't a problem: it currently always delegates to the interpreted code.
I've added some tests so that we won't slip up like this again, including with expansion. It will make dealing with expansion much harder, but that's for the future.
Given [this] ticket, do we need to revisit this? Or do we consider the change for 9.0 but not for 8.x?