Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-11-13
11:18 • Ticket [852e7c1594] append(3tcl) on new variable without ?values? status sti... artifact: 8111c7963a user: serhiy.storchaka
2016-03-07
18:27 • Ticket [852e7c1594]: 3 changes artifact: 3d20a0134b user: dgp
2016-03-01
15:48 • Ticket [852e7c1594]: 3 changes artifact: 5d35a687b5 user: aku
08:18 • New ticket [852e7c1594]. artifact: c7851f340c user: Konrad.Schwarz

append(3tcl) on new variable without ?values?

Open852e7c15949ef7b6ccd66f876b6919a4be00e3bfCreated 11 years agoUpdated 20 days ago
Descriptionplain2016-03-01 08:18:14
append(3tcl) has the following synopsis: append varName ?value value ...?
The man states, "If varName does not exist, it is given a value equal to
the concatentation of all the value arguments."  However, if x is not a variable,
    append x
results in 
    can't read "x": no such variable

I would expect x to be assigned to an empty string.

Contrast this to
    lappend l
which sets l to an empty list, or
    incr i 0
which sets i to zero (as of TCL 8.5).
aku Ticket [852e7c1594]: 3 changes [History diff]2016-03-01 15:48:25
dgpplain2016-03-07 18:27:37
At first glance I tend to agree with you, and I wonder
why this was not picked up in the big TIP 323 effort.

http://www.tcl.tk/cgi-bin/tct/tip/323

I'll try to find time to look in the history of that effort
to see if there's some reason that I've forgotten. If not
we should pursue this for Tcl 8.7+
serhiy.storchaka Ticket [852e7c1594]: 2 changes [History diff]2026-11-13 11:18:46
Log in (anonymous is fine) to add a comment.