| Deutsch English Français Italiano |
|
<vmr8lo$13nsn$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Harald Oehlmann <wortkarg3@yahoo.com>
Newsgroups: comp.lang.tcl
Subject: Re: vectcl and tcl9
Date: Wed, 22 Jan 2025 18:08:08 +0100
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <vmr8lo$13nsn$2@dont-email.me>
References: <vmls4q$38g47$1@dont-email.me> <vmnhsp$3srvj$1@dont-email.me>
<2af45bfa-e1ae-4a45-90c3-83af0678f820@clevelandgolf.com>
<ygajzan4148.fsf@akutech.de> <vmqg9i$uqf1$1@dont-email.me>
<vmqh3r$usa2$1@dont-email.me> <ygafrla5329.fsf@akutech.de>
<ygaa5bi50en.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 22 Jan 2025 18:08:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="daf1f9fb24e711baf92504fb85805fb3";
logging-data="1171351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Qy9yDBCPtx4mJmkfAZQo1"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PtfPOZURGA2DtnWfRHBVbA3ThS0=
In-Reply-To: <ygaa5bi50en.fsf@akutech.de>
Content-Language: en-GB
Bytes: 4638
Am 22.01.2025 um 16:33 schrieb Ralf Fassel:
> * Ralf Fassel <ralfixx@gmx.de>
> | I recompiled vectcl 0.2.1 as provided by Paul against tcl 9.0 and tcl 8.6.15.
> | 'make test' in vectcl fails in many cases with tcl9, where the same
> | tests succeed in 8.6.15.
>>
> | package require vectcl
> | => 0.2.1
> |
> | numarray concat {{1.0 2.0} {3.0 4.0}} 5.0 0
> | tcl 8 => {1.0 2.0} {3.0 4.0} {5.0 5.0}
> | tcl 9 => error: expected integer but got "1.0 2.0"
>
> Ok, being curious...
>
> The deeper reason for those failures is that vectcl uses type info for
> TclObjs, and tcl9 no longer registers type 'int' (cf.
>
> tclObj.c,
> const Tcl_ObjType tclIntType = {
> "int", /* name */
> ...
> };
>
> void TclInitObjSubsystem(void)
>
> 8.6.15
> Tcl_RegisterObjType(&tclIntType);
> 9.0.0
> ---
>
>
> Now vectcl does in two places:
>
> const Tcl_ObjType * tclIntType = Tcl_GetObjType("int");
>
> and compares that in many places to the obj type
>
> if (objPtr->typePtr == tclIntType)
>
> Since 'int' is not registered in 9.0, Tcl_GetObjType will return NULL
> there, thus the vectcl code treats a not-set obj-type as int, which
> explains the errors.
>
> Quick and dirty setting the vectcl lookup variables for
> Tcl_GetObjType("int") to 0xdeadbeef if they are NULL makes all tests
> succeed.
>
>
> --- vectcl-0.2.1/generic/vectcl.c~ 2025-01-22 12:50:45.750839906 +0100
> +++ vectcl-0.2.1/generic/vectcl.c 2025-01-22 16:15:43.747690082 +0100
> @@ -2577,6 +2590,7 @@
> tclListType = (Tcl_ObjType *) Tcl_GetObjType("list");
> tclDoubleType = Tcl_GetObjType("double");
> tclIntType = Tcl_GetObjType("int");
> + if (0 ==tclIntType) tclIntType = 0xdeadbeef;
> #ifndef TCL_WIDE_INT_IS_LONG
> tclWideIntType = Tcl_GetObjType("wideInt");
> #endif
>
>
> --- vectcl-0.2.1/generic/nacomplex.c~ 2015-07-08 22:38:34.000000000 +0200
> +++ vectcl-0.2.1/generic/nacomplex.c 2025-01-22 16:18:04.682876166 +0100
> @@ -67,7 +67,7 @@
>
> /* Maybe this should go into a static const array */
> const Tcl_ObjType * tclDoubleType = Tcl_GetObjType("double");
> - const Tcl_ObjType * tclIntType = Tcl_GetObjType("int");
> + const Tcl_ObjType * tclIntType = Tcl_GetObjType("int") || 0xdeadbeef;
>
> if (objPtr -> typePtr == tclIntType) {
> int value;
>
> % make test
> Tests ended at Wed Jan 22 16:18:11 CET 2025
> all.tcl: Total 210 Passed 210 Skipped 0 Failed 0
>
> Of course this defeats the performance gains intended by the type
> lookup, but since I don't know why "int" is no longer registered as type
> in the tcl core, and what is to be used as substitution, I can not offer
> any better fix for vectcl.
>
> R'
Ralf,
great that you found out, my appreciation !
The same question was raised by TkInter and PerlTk and solved with a new
function. I loosely remember, that Tcl_GetNumber should now be used for
this purpose:
https://core.tcl-lang.org/tips/doc/trunk/tip/638.md
This routine returns the integer type. I suppose, a test fir int is a
result of "TCL_NUMBER_INT".
Nevertheless, we still need Brian, as this "conversion" part was
replaced by the new abstract layer.
Thank you all,
Harald