Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #149: Dew on the telephone lines.


comp / comp.lang.tcl / Re: tcl hidden "cruelties"

SubjectAuthor
* tcl hidden "cruelties"aotto1968
+- Re: tcl hidden "cruelties"Ralf Fassel
+- Re: tcl hidden "cruelties"Alan Grunwald
+* Re: tcl hidden "cruelties"Gerald Lester
|`* Re: tcl hidden "cruelties"aotto1968
| `* Re: tcl hidden "cruelties"Ralf Fassel
|  `- Re: tcl hidden "cruelties"aotto1968
+* Re: tcl hidden "cruelties"aotto1968
|`- Re: tcl hidden "cruelties"aotto1968
`* Re: tcl hidden "cruelties"Rich
 `* Re: tcl hidden "cruelties"aotto1968
  +- Re: tcl hidden "cruelties"et99
  `- Re: tcl hidden "cruelties"Rich

1
Subject: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Thu, 10 Oct 2024 10:20 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: tcl hidden "cruelties"
Date: Thu, 10 Oct 2024 12:20:04 +0200
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <ve89ok$345h7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 10 Oct 2024 12:20:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="25cb8b6260b9b1facaa3101840a8226f";
logging-data="3282471"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Bf8Q4ylLgGY5due42R1tY3IEqZJGIgmA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Z36BYG7PVCvI11mk0/5sGYmnOWs=
Content-Language: en-US
View all headers

Hi,

I am in the process of rewriting my ALC compiler, whereby the back-end is being rewritten from "tabular" to "object-oriented".

Both types of structures have their advantages and disadvantages. The "tabular" structure is suitable for cross-object analysis
and the "object-oriented" structure is suitable for object-specific analysis.

Unfortunately, you can only ever use ONE type of data structure, so I now use the "tabular" structure in the FRONT-END and the
"object-oriented" structure in the BACK-END.

Anyone who knows TCL knows that "refactoring" TCL code is cruel, because it always ends in a huge amount of "broken" code.

Regardless of "broken code", TCL itself has some cruelties in its syntax. Here, for example, the storage of an "array" with a
namespace path, which in TCL always has !! TWO !! commands. ONE command to generate the namespace and ONE command to finally
generate the array.

namespace eval ::funcDEF::MkErrN {}
array set ::funcDEF::MkErrN::my {
RETURN_MAPPING {}
argv {{ME_CXN_MK_MNGN mng}}
class MkErrorC
classC MkErrorC
classM ME_CCC_MkErrorC
func MkErrN
prefix Class
prefixC ClassC
prefixM ME_CCC_MkErrorC
retC MkErrorC
retM ME_CCN_MkErrorC
retOM ME_CCN_MkErrorC
ty sm_
type0M ME_CXN_MK_MNGN
var0 mng
}

mfg

Subject: Re: tcl hidden "cruelties"
From: Ralf Fassel
Newsgroups: comp.lang.tcl
Date: Fri, 11 Oct 2024 07:51 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Fri, 11 Oct 2024 09:51:49 +0200
Lines: 27
Message-ID: <ygabjzrf562.fsf@akutech.de>
References: <ve89ok$345h7$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net QHN8wENYcuXJCGKbQmRt4AZ9XRYS0/CtsBh9IWWpzOfhqUNnM=
Cancel-Lock: sha1:C18ysZ1z7MIeeUEHiihlSaWARuk= sha1:KJwFzfPJYDtnV1o/HO78pQg0iw8= sha256:zAef7PBxxHH9RW2/ZSNSOx0ApdKkwgYOT4B/VKGOUuc=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
View all headers

* aotto1968 <aotto1968@t-online.de>
| Regardless of "broken code", TCL itself has some cruelties in its
| syntax. Here, for example, the storage of an "array" with a namespace
| path, which in TCL always has !! TWO !! commands. ONE command to
| generate the namespace and ONE command to finally
| generate the array.
>
| namespace eval ::funcDEF::MkErrN {}
| array set ::funcDEF::MkErrN::my {
| RETURN_MAPPING {}
--<snip-snip>--
| var0 mng
| }

Well, you *could* do it in one step, but you don't have to ;-)

namespace eval ::funcDEF::MkErrN {
variable my
array set my {
RETURN_MAPPING {}
...
var0 mng
}
}

HTH
R'

Subject: Re: tcl hidden "cruelties"
From: Alan Grunwald
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Fri, 11 Oct 2024 11:34 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nospam.nurdglaw@gmail.com (Alan Grunwald)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Fri, 11 Oct 2024 12:34:26 +0100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <veb2hm$3l35u$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Oct 2024 13:35:19 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3077eb254503fc9c86e9ec5a8b877c54";
logging-data="3837118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fobx0oG9HDjx78g5sBoaElupowcMfvA0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:hZIq7PdgvkoalucUYsTvBWo6CZ0=
In-Reply-To: <ve89ok$345h7$1@dont-email.me>
Content-Language: en-US
View all headers

On 10/10/2024 11:20, aotto1968 wrote:
> Hi,
>
> I am in the process of rewriting my ALC compiler, whereby the back-end
> is being rewritten from "tabular" to "object-oriented".
>
> Both types of structures have their advantages and disadvantages. The
> "tabular" structure is suitable for cross-object analysis and the
> "object-oriented" structure is suitable for object-specific analysis.
>
> Unfortunately, you can only ever use ONE type of data structure, so I
> now use the "tabular" structure in the FRONT-END and the
> "object-oriented" structure in the BACK-END.
>
> Anyone who knows TCL knows that "refactoring" TCL code is cruel, because
> it always ends in a huge amount of "broken" code.
>
> Regardless of "broken code", TCL itself has some cruelties in its
> syntax. Here, for example, the storage of an "array" with a namespace
> path, which in TCL always has !! TWO !! commands. ONE command to
> generate the namespace and ONE command to finally generate the array.
>
> namespace eval ::funcDEF::MkErrN {}
> array set ::funcDEF::MkErrN::my {
>     RETURN_MAPPING                                     {}
>     argv                                               {{ME_CXN_MK_MNGN
> mng}}
>     class                                              MkErrorC
>     classC                                             MkErrorC
>     classM                                             ME_CCC_MkErrorC
>     func                                               MkErrN
>     prefix                                             Class
>     prefixC                                            ClassC
>     prefixM                                            ME_CCC_MkErrorC
>     retC                                               MkErrorC
>     retM                                               ME_CCN_MkErrorC
>     retOM                                              ME_CCN_MkErrorC
>     ty                                                 sm_
>     type0M                                             ME_CXN_MK_MNGN
>     var0                                               mng
> }
>
> mfg

You are absolutely correct. Choice of data structure, programming style
and programming language is always a compromise. If we are lucky, time
shows that the choices we made were the right ones, for us and for the
job in hand.

Often things prove otherwise, and we are faced with the choice between
reworking everything to change the choices we made previously that we
now view as mistakes, or to accept that some things are more difficult
than they might have been and persevere down the route we chose previously.

As previously we make a choice and in time we can form a view as to
whether we made the right or wrong choice.

In my experience it's never profitable, or helpful, to spend much time
mourning or moaning about the choices we make. Review them, by all
means; if we've made the wrong choice try to determine why we made that
choice and resolve to choose better next time. It's the only way!

besten gruesse

Subject: Re: tcl hidden "cruelties"
From: Gerald Lester
Newsgroups: comp.lang.tcl
Organization: fastusenet - www.fastusenet.org
Date: Fri, 11 Oct 2024 12:27 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!news.mixmin.net!news.neodome.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx11.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: tcl hidden "cruelties"
Newsgroups: comp.lang.tcl
References: <ve89ok$345h7$1@dont-email.me>
Content-Language: en-US
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <ve89ok$345h7$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 51
Message-ID: <tQ8OO.245862$kxD8.99862@fx11.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Fri, 11 Oct 2024 12:27:05 UTC
Organization: fastusenet - www.fastusenet.org
Date: Fri, 11 Oct 2024 07:27:05 -0500
X-Received-Bytes: 3567
View all headers

On 10/10/24 05:20, aotto1968 wrote:
> Hi,
>
> ...
>
> Anyone who knows TCL knows that "refactoring" TCL code is cruel, because
> it always ends in a huge amount of "broken" code.

Well I guess that is true if your code has lots of hidden dependencies
and is otherwise not well designed in structured.

> Regardless of "broken code", TCL itself has some cruelties in its
> syntax. Here, for example, the storage of an "array" with a namespace
> path, which in TCL always has !! TWO !! commands. ONE command to
> generate the namespace and ONE command to finally generate the array.

Ah, I don't know of a single language, including Python, where the
namespace does not have to be "defined" prior to things being "created"
inside of it!

> namespace eval ::funcDEF::MkErrN {}
> array set ::funcDEF::MkErrN::my {
>     RETURN_MAPPING                                     {}
>     argv                                               {{ME_CXN_MK_MNGN
> mng}}
>     class                                              MkErrorC
>     classC                                             MkErrorC
>     classM                                             ME_CCC_MkErrorC
>     func                                               MkErrN
>     prefix                                             Class
>     prefixC                                            ClassC
>     prefixM                                            ME_CCC_MkErrorC
>     retC                                               MkErrorC
>     retM                                               ME_CCN_MkErrorC
>     retOM                                              ME_CCN_MkErrorC
>     ty                                                 sm_
>     type0M                                             ME_CXN_MK_MNGN
>     var0                                               mng
> }

As Ralf Fassel noted, you could have done:

namespace eval ::funcDEF::MkErrN {
variable my
array set my {
RETURN_MAPPING {}
...
var0 mng
}
}

Subject: Re: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sat, 12 Oct 2024 12:46 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Sat, 12 Oct 2024 14:46:49 +0200
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <vedr3p$5rrn$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <tQ8OO.245862$kxD8.99862@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 12 Oct 2024 14:46:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="30bedcceaeb7cb2a1de52d966e9f2bb6";
logging-data="192375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ImvaM9Dt5wMLRET1TorYHUzV9uvfaS0w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:CuElgYIbrRcPnL37Lx7ch/fN1/w=
In-Reply-To: <tQ8OO.245862$kxD8.99862@fx11.iad>
Content-Language: en-US
View all headers

On 11.10.24 14:27, Gerald Lester wrote:
> On 10/10/24 05:20, aotto1968 wrote:
>> Hi,
>>
>> ...
>>
>> Anyone who knows TCL knows that "refactoring" TCL code is cruel, because it always ends in a huge amount of "broken" code.
>
> Well I guess that is true if your code has lots of hidden dependencies and is otherwise not well designed in structured.
>
>> Regardless of "broken code", TCL itself has some cruelties in its syntax. Here, for example, the storage of an "array" with a
>> namespace path, which in TCL always has !! TWO !! commands. ONE command to generate the namespace and ONE command to finally
>> generate the array.
>
> Ah, I don't know of a single language, including Python, where the namespace does not have to be "defined" prior to things being
> "created" inside of it!
>
>> namespace eval ::funcDEF::MkErrN {}
>> array set ::funcDEF::MkErrN::my {
>>      RETURN_MAPPING                                     {}
>>      argv                                               {{ME_CXN_MK_MNGN mng}}
>>      class                                              MkErrorC
>>      classC                                             MkErrorC
>>      classM                                             ME_CCC_MkErrorC
>>      func                                               MkErrN
>>      prefix                                             Class
>>      prefixC                                            ClassC
>>      prefixM                                            ME_CCC_MkErrorC
>>      retC                                               MkErrorC
>>      retM                                               ME_CCN_MkErrorC
>>      retOM                                              ME_CCN_MkErrorC
>>      ty                                                 sm_
>>      type0M                                             ME_CXN_MK_MNGN
>>      var0                                               mng
>> }
>
> As Ralf Fassel noted, you could have done:
>
>     namespace eval ::funcDEF::MkErrN {
>       variable my
>       array set my {
>           RETURN_MAPPING {}
>           ...
>           var0 mng
>       }
>     }
>

this example has 3 commands

1. namespace eval
2. variable
3. array set

one more than my example

the core question is why the NS is *NOT* created by default.
-> If you can raise an error you can also create the namespace.

the core-issue here is that the "TCL" maintainer wants to protect the programmer for itself...
-> this is usually a "bad" habit because the maintainer try to know better what the programmer wants
as the programmer itself.

just for the background, a "dynamic-namespace" in TCL is something like a "pointer" in C because a "POINTER" open an
"dynamic-namespace" in C. the TCL advantage is that you can choose a *good* name for the pointer, in my case something like
"::class::$instance" and the "::call::$instance::my" is just the instance memory.

the TCL maintainer has a view on the "namespace" feature like a traditional "namespace" in c++ or java etc but lost the
dynamic-pointer view of the "namespace".

Subject: Re: tcl hidden "cruelties"
From: Ralf Fassel
Newsgroups: comp.lang.tcl
Date: Sat, 12 Oct 2024 15:05 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Sat, 12 Oct 2024 17:05:20 +0200
Lines: 13
Message-ID: <yga7cadfjkf.fsf@akutech.de>
References: <ve89ok$345h7$1@dont-email.me> <tQ8OO.245862$kxD8.99862@fx11.iad>
<vedr3p$5rrn$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net Pjx8mBw72ihmz8EP8YKPmAGZHvu4VfqrE4mj4kzXaE7JBdpVw=
Cancel-Lock: sha1:qRQp9ftv2mmfFXCPNxYh7GH0PKg= sha1:vR86YDNWk8iEEbF9EoOYwmUVe3c= sha256:fstfdhT55nefYe0S7aaWhkMrwZ0ahN1v8OVcRIMsrhE=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
View all headers

* aotto1968 <aotto1968@t-online.de>
| the core question is why the NS is *NOT* created by default.
| -> If you can raise an error you can also create the namespace.

If you have ever happend to have a namespace tpyo in your 'array set'
command, and did not see it while looking straight at it for half an
hour, you would be grateful for TCL telling you that you mistyped it.

Anyway, this discussion is moot, as I don't think TCL will change in
that respect. I at least would object to auto-creating the namespace :-)

EOD4me...
R'

Subject: Re: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sun, 13 Oct 2024 08:25 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Sun, 13 Oct 2024 10:25:58 +0200
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <veg06m$k12k$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <tQ8OO.245862$kxD8.99862@fx11.iad>
<vedr3p$5rrn$1@dont-email.me> <yga7cadfjkf.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Oct 2024 10:25:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c4deb3f725a725d6ec04a9f544a2f92f";
logging-data="656468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19B2aW3hc0NAqyuZtAnzgEE/VZRX+ewy04="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:yX7fM+kDO9IHsD+Gv/PoHHKqOWI=
In-Reply-To: <yga7cadfjkf.fsf@akutech.de>
Content-Language: en-US
View all headers

On 12.10.24 17:05, Ralf Fassel wrote:
> * aotto1968 <aotto1968@t-online.de>
> | the core question is why the NS is *NOT* created by default.
> | -> If you can raise an error you can also create the namespace.
>
> If you have ever happend to have a namespace tpyo in your 'array set'
> command, and did not see it while looking straight at it for half an
> hour, you would be grateful for TCL telling you that you mistyped it.
>
> Anyway, this discussion is moot, as I don't think TCL will change in
> that respect. I at least would object to auto-creating the namespace :-)
>
> EOD4me...
> R'

this is not as trivial as it look like because TCL by default is NON-declaration language.

> set myvar 1

always succeed because you don't have to "declare" the "myvar" and just set it

in difference to

> set ::myns::myvar

you have to declare the "myns" this is just an extra unnecessary step this make everything more complex without
adding any advantage.

> "If you have ever happened to have a namespace typo in your 'array set'"

as I mentioned early → you want to protect the programmer for itself → this is just a bad behavior.

You have to treat the "myns" as part of the name like "myns_myvar" etc in old TCL days without NS

> set myns_myvar 1

would never be complied by TCL because the "myns" prefix was just chosen by the programmer.

mfg

Subject: Re: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sun, 13 Oct 2024 12:29 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Sun, 13 Oct 2024 14:29:46 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <vegefq$m562$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Oct 2024 14:29:46 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c4deb3f725a725d6ec04a9f544a2f92f";
logging-data="726210"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YKYrLOD0hggljV+G+OLgdYsPJ/4/XV38="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0Wm9OPWwv5Gg4UqXgYaY38MPdOI=
Content-Language: en-US
In-Reply-To: <ve89ok$345h7$1@dont-email.me>
View all headers

On 10.10.24 12:20, aotto1968 wrote:
> Hi,
>
> I am in the process of rewriting my ALC compiler, whereby the back-end is being rewritten from "tabular" to "object-oriented".
>
> Both types of structures have their advantages and disadvantages. The "tabular" structure is suitable for cross-object analysis
> and the "object-oriented" structure is suitable for object-specific analysis.
>
> Unfortunately, you can only ever use ONE type of data structure, so I now use the "tabular" structure in the FRONT-END and the
> "object-oriented" structure in the BACK-END.
>
> Anyone who knows TCL knows that "refactoring" TCL code is cruel, because it always ends in a huge amount of "broken" code.

here we are…

146 files changed, 8351 insertions(+), 6129 deletions(-)

~8351 changes later, the NEW ALC compiler is in duty :-)

https://www.facebook.com/photo/?fbid=853356390326470&set=a.805828751745901

Subject: Re: tcl hidden "cruelties"
From: Rich
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Mon, 14 Oct 2024 01:44 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Mon, 14 Oct 2024 01:44:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <veht1v$t9io$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me>
Injection-Date: Mon, 14 Oct 2024 03:44:31 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cc5d4c666b466bfc5100f8b5eadc1ad0";
logging-data="960088"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tI7iT0d00voryDRTvL0ZE"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:bMjJgsIoj9c9SA+nokzETDGnPAA=
View all headers

aotto1968 <aotto1968@t-online.de> wrote:
> Regardless of "broken code", TCL itself has some cruelties in its
> syntax. Here, for example, the storage of an "array" with a
> namespace path, which in TCL always has !! TWO !! commands. ONE
> command to generate the namespace and ONE command to finally generate
> the array.
>
> namespace eval ::funcDEF::MkErrN {}
> array set ::funcDEF::MkErrN::my {
> RETURN_MAPPING {}
> ...
> }

This is Tcl. If something is that bothersome, just morph the language
to be the way you want it to work. I.e.:

proc ns-array-set {fullvarname contents} {
namespace eval [namespace qualifiers $fullvarname] {}
array set $fullvarname $contents
}

Create that once, then use it, instead of plain "array set" whenever
you want to create a namespace, and then set an array within, i.e.:

% ns-array-set abc::pdq::xyz [list a 1 b 2 c 3]

Which has now, in a single command, created the parent namespaces, and
the array variable therein:

% info exists abc::pdq::xyz
1
% parray abc::pdq::xyz
abc::pdq::xyz(a) = 1
abc::pdq::xyz(b) = 2
abc::pdq::xyz(c) = 3
%

And, given that the 'array' command is itself a namespace ensemble, you
could extend the 'array' ensemble to add a "ns-set" (or whatever name
you like) to the ensemble that performs the above "create ns - and
init" of a namespace variable, then you could do
"array ns-set [list a 1 b 2]"
in your code to replace the two commands.

Subject: Re: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Mon, 14 Oct 2024 07:41 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Mon, 14 Oct 2024 09:41:04 +0200
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <veihug$13uq8$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <veht1v$t9io$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Oct 2024 09:41:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="99ed8f2dc5d57fc8463e9e291a95e614";
logging-data="1178440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JwHGXStCkr32gZ0vnboxp5HCHHnBnPVs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:HJTyOzbpeNbJ5rmloiiusHUEYpY=
Content-Language: en-US
In-Reply-To: <veht1v$t9io$1@dont-email.me>
View all headers

On 14.10.24 03:44, Rich wrote:
> aotto1968 <aotto1968@t-online.de> wrote:
>> Regardless of "broken code", TCL itself has some cruelties in its
>> syntax. Here, for example, the storage of an "array" with a
>> namespace path, which in TCL always has !! TWO !! commands. ONE
>> command to generate the namespace and ONE command to finally generate
>> the array.
>>
>> namespace eval ::funcDEF::MkErrN {}
>> array set ::funcDEF::MkErrN::my {
>> RETURN_MAPPING {}
>> ...
>> }
>
> This is Tcl. If something is that bothersome, just morph the language
> to be the way you want it to work. I.e.:
>
> proc ns-array-set {fullvarname contents} {
> namespace eval [namespace qualifiers $fullvarname] {}
> array set $fullvarname $contents
> }
>
> Create that once, then use it, instead of plain "array set" whenever
> you want to create a namespace, and then set an array within, i.e.:
>
> % ns-array-set abc::pdq::xyz [list a 1 b 2 c 3]
>
> Which has now, in a single command, created the parent namespaces, and
> the array variable therein:
>
> % info exists abc::pdq::xyz
> 1
> % parray abc::pdq::xyz
> abc::pdq::xyz(a) = 1
> abc::pdq::xyz(b) = 2
> abc::pdq::xyz(c) = 3
> %
>
> And, given that the 'array' command is itself a namespace ensemble, you
> could extend the 'array' ensemble to add a "ns-set" (or whatever name
> you like) to the ensemble that performs the above "create ns - and
> init" of a namespace variable, then you could do
> "array ns-set [list a 1 b 2]"
> in your code to replace the two commands.
>

your hint with the "ensemble" feature was good but missing the required code.
to "extend" an ensemble is quite complicate in TCL… follow the code below:

proc ::array-ns-set {fullvarname contents} {
namespace eval [namespace qualifiers $fullvarname] {}
array set $fullvarname $contents
}

namespace ensemble configure array -map [dict replace \
[namespace ensemble configure array -map] ns-set ::array-ns-set]

array ns-set ::x::my [list a 1 b 2]

parray ::x::my

1) but the CORE problem is not solved, for every "namespace ns-set ..." command TWO commands
are executed just to avoid FIRST namespace missing error.
→ (ALL pay runtime-speed just for FIRST benefit)

2) the syntax to extend an existing ensemble is still very "ugly.."

improvement:
> 1. namespace ensemble add array ns-set ::array-ns-set
> 2. namespace ensemble delete array ns-set

Subject: Re: tcl hidden "cruelties"
From: et99
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Mon, 14 Oct 2024 17:33 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Mon, 14 Oct 2024 10:33:54 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <vejkm2$19kb8$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <veht1v$t9io$1@dont-email.me>
<veihug$13uq8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Oct 2024 19:33:54 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a6d18d01de1ce3bb5fc6c59a2e2fafcd";
logging-data="1364328"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18yfZtJ5qhcErxiNNx9htQo"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wZO0xirqGM2MtwTAL6Y7MHhcZIo=
Content-Language: en-US
In-Reply-To: <veihug$13uq8$1@dont-email.me>
View all headers

On 10/14/2024 12:41 AM, aotto1968 wrote:

>
> 1) but the CORE problem is not solved, for every "namespace ns-set ..." command TWO commands
> are executed just to avoid FIRST namespace missing error.
> → (ALL pay runtime-speed just for FIRST benefit)
>
> 2) the syntax to extend an existing ensemble is still very "ugly.."
>
> improvement:
> > 1. namespace ensemble add     array ns-set ::array-ns-set
> > 2. namespace ensemble delete  array ns-set

If you have a proposal to improve the TCL language then the TIP mechanism is the approach to take.

However, IMHO, namespace commands, especially ones that create namespaces should be done with the [namespace] command. It would be helpful to be able to grep for "namespace" to find all the relevant commands. Having an exception, where some other command also can create a namespace seems quite odd to me and could cause some confusion for someone other than the author trying to understand or maintain a TCL program.

As to performance, I doubt that a command very likely done but once in a program will cause any issues in that regard.

That said, I wouldn't mind seeing a command:

namespace create name ?script?

which seems to me to be an oversight. When I first looked into namespaces, I found it odd that they were created with the eval option. At minimum, this would be a useful self documenting addition.

-e

Subject: Re: tcl hidden "cruelties"
From: Rich
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Mon, 14 Oct 2024 18:13 UTC
References: 1 2 3
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Mon, 14 Oct 2024 18:13:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <vejn0u$1a2ms$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <veht1v$t9io$1@dont-email.me> <veihug$13uq8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 14 Oct 2024 20:13:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cc5d4c666b466bfc5100f8b5eadc1ad0";
logging-data="1379036"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ic7Xz9wn/Sd27QgitT6lT"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Cancel-Lock: sha1:gHuOhqqZU9tpnmyBszLUTzoQk1M=
View all headers

aotto1968 <aotto1968@t-online.de> wrote:
> On 14.10.24 03:44, Rich wrote:
>> aotto1968 <aotto1968@t-online.de> wrote:
>>> Regardless of "broken code", TCL itself has some cruelties in its
>>> syntax. Here, for example, the storage of an "array" with a
>>> namespace path, which in TCL always has !! TWO !! commands. ONE
>>> command to generate the namespace and ONE command to finally generate
>>> the array.
>>
>> This is Tcl. If something is that bothersome, just morph the language
>> to be the way you want it to work. I.e.:
>>
>> proc ns-array-set {fullvarname contents} {
>> namespace eval [namespace qualifiers $fullvarname] {}
>> array set $fullvarname $contents
>> }
>>
>> Create that once, then use it, instead of plain "array set" ...
>
> your hint with the "ensemble" feature was good but missing the required code.

Yes, I left that exercise to the reader to work out.

> to "extend" an ensemble is quite complicate in TCL… follow the code below:

As are most /things/ in most programming languages.

> 1) but the CORE problem is not solved, for every "namespace ns-set
> ..." command TWO commands are executed just to avoid FIRST namespace
> missing error. → (ALL pay runtime-speed just for FIRST benefit)

You'll pay that runtime no matter whether it appears as one, or two,
commands in your source. The 'work' of checking if the namespace
exists, and then creating it when it does not, has to be paid, no
matteer how many 'commands' appear in the Tcl script.

> 2) the syntax to extend an existing ensemble is still very "ugly.."
>
> improvement:
>> 1. namespace ensemble add array ns-set ::array-ns-set
>> 2. namespace ensemble delete array ns-set

You can 'wrap' that ugliness into your own proc, and 'extend' the
namespace ensemble itself, to remove that as well if you like.

Subject: Re: tcl hidden "cruelties"
From: aotto1968
Newsgroups: comp.lang.tcl
Organization: A noiseless patient Spider
Date: Sun, 20 Oct 2024 13:01 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: tcl hidden "cruelties"
Date: Sun, 20 Oct 2024 15:01:25 +0200
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <vf2uv5$dv81$1@dont-email.me>
References: <ve89ok$345h7$1@dont-email.me> <vegefq$m562$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 20 Oct 2024 15:01:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a595dbb61a6f3be4400c8187c2e27cfe";
logging-data="457985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jFJ69FZuCf1RB5a26mdkcnJh8a2ogtX4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:R/bcF8iEpVNWX+X/2w0lXp1nGuc=
Content-Language: en-US
In-Reply-To: <vegefq$m562$1@dont-email.me>
View all headers

> git diff --shortstat alc-new-1-lw .
83 files changed, 5214 insertions(+), 5300 deletions(-)

The last step in converting the ALC compiler to the "object" structure has now been completed.

The "attribute database" is the largest and most important database in the ALC architecture because attributes from all other
databases are stored there and thus there is a connection to all other databases. The "object"-specific attributes are now
stored in the data structure of the "object", which means that, in contrast to the "table" structure, the "access path" to the
attribute is now static, which is an *enormous* gain in speed while simplifying the "ALC code".

The ALC compiler consists of three "layers". "frontend", "middleware" and "backend". The "frontend" now uses the "table"
structure and the "backend" uses the "object structure". When converting the "backend" from the "table" to the "object"
structure, hidden "logic problems" came to light that were also eliminated and at the same time it also helps to consolidate the
"layers" themselves because an analysis can only be implemented most efficiently *either* in the "table" structure or only in
the "object" structure, which then *necessarily* triggers a certain reorganization of the ALC code.

The "frontend" layer creates the "meta-code" which:
1. implements a "singular" definition of information
2. is "ordered" in terms of structure, which always delivers the same "logic" "output" for "logic"-like "input".
3. is intended to be stored in the *code repository* in order to ultimately secure the API or to centrally verify a change.
4. is human-readable and changeable in order to quickly create "test data" to create or to add your own "meta-code" extensions.

The "middleware" layer creates the "compiler code" which is used *internally* to control the backend very quickly and
efficiently. In addition, the "middleware" layer has a basic analysis of the "meta-code" and creates a variety of
"access-oriented" data structures from the "singular" "meta-code". The "middleware" layer uses a type of "hibernate" technology
to store a "memory dump" on the hard disk after the successful "meta-code analysis". The ALC compiler can also skip the
"middleware layer" with the command line switch "-force", which then means that the "backend layer" is controlled directly with
the "meta code", which is of course slower but is used for "recursive compilations" (generation of "meta code" from "meta code").

The "backend layer" now creates the desired target, which is then a programming language, a data file or any structured data
storage with a defined format.

https://www.facebook.com/permalink.php?story_fbid=pfbid037cZ3kX4yBNxZNv8NQ6vtpq6nomq6YCWsjhKpPoXbyQ5RXxRrc9YnMAfoa9dAAtvVl&id=100069563501101

1

rocksolid light 0.9.8
clearnet tor