beetlebug▾
/

tsv object

Gives a command that runs the tsv commands on one element.

tsv::object ARRAY ELEMENT

Description

The command tsv::object gives the name of a new command, such as ::tsv::obj0x0, for the element ELEMENT of ARRAY. A call CMD NAME ?ARG ...? runs tsv::NAME ARRAY ELEMENT ?ARG ...?, so $o set 5 is tsv::set ARRAY ELEMENT 5. The element does not need to exist.

Arguments

ArgumentTypeDefaultDescription
ARRAYarray namerequiredThe name of the shared array.
ELEMENTstringrequiredThe name of the element.

Returns

The name of the new command.

Examples

% tsv::object o el
::tsv::obj0x0

% set o [tsv::object o el]
> $o set 5
> $o incr 2
7

% set o [tsv::object o el]
> $o set {1 2}
> list [$o llength] [$o lindex 0] [$o exists]
2 1 1

Errors

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

% set o [tsv::object o el]
> $o bogus
invalid command name "bogus"
-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