Overview
| Artifact ID: | 75b62c0eac95e136854ca5cc584fa0406af2879c |
|---|---|
| Ticket: | 1049119fffffffffffffffffffffffffffffffff
append and lappend with one arg undocumented & inconsistent |
| User & Date: | nobody on 2004-10-20 15:27:21 |
Changes
- icomment:
Logged In: NO I would bet that behavior of [append x] is accidental. While I do not see reasons for a deliberate difference, I see some difference in motivation to mess with [append x] and [lappend x]. If [append x] fails to do what I expect it to do, I can use [append x ""] instead. There would be no such replacement for defunct [lappend x]. It is therefore easier for [append x] to escape attention. If somebody discovered that current strange behavior of [append x] is exactly equivalent to [set x], did not submit a bug report and went on to create programs dependent on this, than he well deserves some punishment like incompatible change of [append x] :-) On the other hand, [lappend x] is currently equivalent to [if {![info exists x]} {set x ""}] (well, return value is different) and might be used as a nice shorthand. Some smarties might even routinely do: eval lappend x $y instead of: if {![info exists x]} { set x {} } set x [concat $x $y] After some googling for "eval lappend" and "eval append" I see that both are used and fixing [eval x] might actually fix more programs than it breaks. Vaclav Hanzl, email: hanzl (x@x) noel.feld.cvut.cz - login: "nobody"
- mimetype: "text/plain"
- username: "nobody"