Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Afternoon very favorable for romance. Try a single person for a change.


comp / comp.lang.tcl / Funny TCL and C api missing access to namespace variable.

SubjectAuthor
* Funny TCL and C api missing access to namespace variable.aotto1968
`- Re: Funny TCL and C api missing access to namespace variable.Rich

1
Subject: Funny TCL and C api missing access to namespace variable.
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 3 Jan 2025 10:55 UTC
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Funny TCL and C api missing access to namespace variable.
Date: Fri, 3 Jan 2025 11:55:38 +0100
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <vl8fnc$3s88a$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 03 Jan 2025 11:55:40 +0100 (CET)
Injection-Info: dont-email.me; posting-host="bfcf6e41a8af79f2f3416b784180c3ca";
logging-data="4071690"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+O4/LFkgatq1gz/cgCFK8zX2ec0DmMrjM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:riCyeWdfcMV/jW21UwBqNi3Stfg=
Content-Language: en-US
View all headers

Tcl has a C api … good

1) for *namespace* -> man Tcl_CreateNamespace ...
2) for *set at variable* -> man Tcl_ObjSetVar2 ...

but tcl has *no* C-Api to access a namespace variable :-)

to access a namespace variable in "C" you have to construct the
variable-name-string fist .. like:

> Tcl_Obj* myO = Tcl_ObjPrintf("%s::%s", ns_cstr, var_cstr)
> (by the way the "Tcl_ObjPrintf" missing format specifier for "Tcl_Obj*")

and than use the *string* to access the variable;

> Tcl_ObjSetVar2(interp,myO,?array-key or NULL?,newVal,flags)

The funny thing is that the "TclObjLookupVar" always disassemble the "myO" string
to figure out the namespace/array-key etc…

To make it short, Tcl need a *better* Tcl_Set/GetVar??? api perhaps "3" with
namespace,variable,arrayItem separated to speedup access.

> Tcl_ObjSetVar3(interp,myNs,myVar,myKey,newObj,flags)

and SKIP the parsing of "myVar" for either myNs or myKey.

The problem is NOT the 1-time access of a variable because the variable is AFTER
access cached, the problem is the *multiple* access with either *namespace* or
*varname* is very dynamic.

→ just a "hint"

Subject: Re: Funny TCL and C api missing access to namespace variable.
From: Rich
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 3 Jan 2025 13:12 UTC
References: 1
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Funny TCL and C api missing access to namespace variable.
Date: Fri, 3 Jan 2025 13:12:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <vl8no1$3tllr$1@dont-email.me>
References: <vl8fnc$3s88a$1@dont-email.me>
Injection-Date: Fri, 03 Jan 2025 14:12:33 +0100 (CET)
Injection-Info: dont-email.me; posting-host="f70fcd979b09915f744ad22468595f16";
logging-data="4118203"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jVR7JQNIIPYdItsVVYrKM"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:nXSpsyFgvgOf+qEhT0i/LMGayZg=
View all headers

aotto1968 <aotto1968@t-online.de> wrote:
>
> To make it short, Tcl need a *better* Tcl_Set/GetVar??? api perhaps
> "3" with namespace,variable,arrayItem separated to speedup access.

Write up a TIP and supply an implementation and your request might be
accepted into the Tcl core.

1

rocksolid light 0.9.8
clearnet tor