beetlebug▾
/

tsv move

Gives an element of a shared array a new name.

tsv::move ARRAY ELEMENT NEWNAME

Description

The command tsv::move moves the value of ELEMENT to the element NEWNAME of the same array, and removes ELEMENT. NEWNAME must not exist.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringrequiredThe element to move.
NEWNAMEstringrequiredThe new name of the element.

Returns

An empty string.

Examples

% tsv::set m a 1
> tsv::move m a b
> list [tsv::get m b] [tsv::exists m a]
1 0

Errors

% tsv::move m
wrong # args: should be "tsv::move array key ?args?"
-errorcode TCL WRONGARGS

% tsv::set m a 1
> tsv::move m nope c
no key m(nope)
-errorcode NONE

% tsv::set m a 1
> tsv::set m c 3
> tsv::move m a c
key "c" exists
-errorcode NONE

Facts

Capability
thread. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also