Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Beeping is cute, if you are in the office ;) -- Alan Cox


devel / comp.lang.tcl / missing feature in TCL

SubjectAuthor
* missing feature in TCLaotto1968
+- Re: missing feature in TCLGerald Lester
+- Re: missing feature in TCLet99
+* Re: missing feature in TCLLuc
|`* Re: missing feature in TCLaotto1968
| `* Re: missing feature in TCLbriang
|  `- Re: missing feature in TCLaotto1968
`* Re: missing feature in TCLMole Cool
 +* Re: missing feature in TCLaotto1968
 |`- Re: missing feature in TCLMole Cool
 `- Re: missing feature in TCLRich

1
missing feature in TCL

<tvmfk5$24jnf$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21589&group=comp.lang.tcl#21589

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: missing feature in TCL
Date: Sat, 25 Mar 2023 10:41:24 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <tvmfk5$24jnf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 25 Mar 2023 09:41:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1b8aadb0eddbb2441791993372ad0d94";
logging-data="2248431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WlTM/pjTJwoRnRTtOPdQUjxeiZMcIyPE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:E33KhYmVksPV++NYRmM7BM4/0nU=
Content-Language: en-US
 by: aotto1968 - Sat, 25 Mar 2023 09:41 UTC

Hi, I use a TCL project with multiple files involved and *proc* multiple times defined with the same name.
the reason is to have a "generic" definition of a *proc* and sometimes I need a more specific definition
who overwrites the generic definition.

For debugging it would be very useful if I have something like `info proc-attribute *procname*`
which return the *file* and/or the *line* where the *proc* was defined.

The implementation is probably simple because this details are know at the time a *proc* defined.

To make the interface more command it could look like:

info proc args "procname" → return the arguments
info proc body "procname" → return the body
info proc file "procname" → return the definition file
info proc line "procname" → return the definition line in file

the proc-attribute feature could also be used to add additional features to a *proc* like *non-overwrite* etc

mfg AO

Re: missing feature in TCL

<_wDTL.97027$LAYb.31884@fx02.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21590&group=comp.lang.tcl#21590

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx02.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Subject: Re: missing feature in TCL
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <tvmfk5$24jnf$1@dont-email.me>
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <tvmfk5$24jnf$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 29
Message-ID: <_wDTL.97027$LAYb.31884@fx02.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Sat, 25 Mar 2023 14:27:06 UTC
Organization: fastusenet - www.fastusenet.org
Date: Sat, 25 Mar 2023 09:27:06 -0500
X-Received-Bytes: 1836
 by: Gerald Lester - Sat, 25 Mar 2023 14:27 UTC

On 3/25/23 04:41, aotto1968 wrote:
>
> Hi, I use a TCL project with multiple files involved and *proc* multiple
> times defined with the same name.
> the reason is to have a "generic" definition of a *proc* and sometimes I
> need a more specific definition
> who overwrites the generic definition.
>
> For debugging it would be very useful if I have something like `info
> proc-attribute *procname*`
> which return the *file* and/or the *line* where the *proc* was defined.
>
> The implementation is probably simple because this details are know at
> the time a *proc* defined.
>
> To make the interface more command it could look like:
>
> info proc args "procname"    → return the arguments
> info proc body "procname"    → return the body
> info proc file "procname"    → return the definition file
> info proc line "procname"    → return the definition line in file
>
> the proc-attribute feature could also be used to add additional features
> to a *proc* like *non-overwrite* etc
>
> mfg AO

Please make a TIP of this and submit a proposed implementation.

Re: missing feature in TCL

<tvn984$28rc8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21591&group=comp.lang.tcl#21591

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sat, 25 Mar 2023 09:58:44 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <tvn984$28rc8$1@dont-email.me>
References: <tvmfk5$24jnf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 25 Mar 2023 16:58:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="42898c68fd6f65ecdb4ebb33be4ed882";
logging-data="2387336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zrORGZjb2LDE58VglMB3k"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:Kj1YhGRXuk5GTSFbATUgAXL42us=
Content-Language: en-US
In-Reply-To: <tvmfk5$24jnf$1@dont-email.me>
 by: et99 - Sat, 25 Mar 2023 16:58 UTC

On 3/25/2023 2:41 AM, aotto1968 wrote:
>
> Hi, I use a TCL project with multiple files involved and *proc* multiple times defined with the same name.
> the reason is to have a "generic" definition of a *proc* and sometimes I need a more specific definition
> who overwrites the generic definition.
>
> For debugging it would be very useful if I have something like `info proc-attribute *procname*`
> which return the *file* and/or the *line* where the *proc* was defined.
>
> The implementation is probably simple because this details are know at the time a *proc* defined.
>
> To make the interface more command it could look like:
>
> info proc args "procname"    → return the arguments
> info proc body "procname"    → return the body
> info proc file "procname"    → return the definition file
> info proc line "procname"    → return the definition line in file
>
> the proc-attribute feature could also be used to add additional features to a *proc* like *non-overwrite* etc
>
> mfg AO

I'm not certain, but you may be able to use [info
frame] for this along with a [trace] and/or [rename]
of [proc]. I've used info frame in a debugging tool to
get line and file info. Also, an error has this info,
but I don't know how it gets it.

Re: missing feature in TCL

<20230325160209.2f932cab@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21592&group=comp.lang.tcl#21592

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sat, 25 Mar 2023 16:02:09 -0300
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <20230325160209.2f932cab@lud1.home>
References: <tvmfk5$24jnf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: dont-email.me; posting-host="aae2fb8a2bab7bdc5bed4f3ff7b796f5";
logging-data="2418191"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19LQFra8klbHS+9FKQi156/3ToQG4jlhME="
Cancel-Lock: sha1:AodS5F+2zr7kXX+vpkpLI47NpN4=
 by: Luc - Sat, 25 Mar 2023 19:02 UTC

On Sat, 25 Mar 2023 10:41:24 +0100, aotto1968 wrote:

> Hi, I use a TCL project with multiple files involved and *proc* multiple
> times defined with the same name. the reason is to have a "generic"
> definition of a *proc* and sometimes I need a more specific definition
> who overwrites the generic definition.
>
> For debugging it would be very useful if I have something like `info
> proc-attribute *procname*` which return the *file* and/or the *line*
> where the *proc* was defined.
>
> The implementation is probably simple because this details are know at
> the time a *proc* defined.
>
> To make the interface more command it could look like:
>
> info proc args "procname" → return the arguments
> info proc body "procname" → return the body
> info proc file "procname" → return the definition file
> info proc line "procname" → return the definition line in file
>
> the proc-attribute feature could also be used to add additional features
> to a *proc* like *non-overwrite* etc
>
> mfg AO

I don't know. Seems to me that you should rather go with two procs:

proc usual {args} {
do the usual
}

proc chameleon {args} {
some odd job
}

One has to wonder if you really need that much flexibility though. It's
reasonable to guess that you probably deal with few enough situations
that you could have one proc (or switch clause inside one proc) for each
particular case instead of rewriting procs on the fly. Do you even remember
what those temporary procs do when you maintain your code?
And if you need to know *when* the proc was changed to use or manage it,
it sounds like you are skating on thin ice.

--
Luc
>>

Re: missing feature in TCL

<tvnjgr$2ajt9$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21594&group=comp.lang.tcl#21594

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sat, 25 Mar 2023 20:54:03 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <tvnjgr$2ajt9$2@dont-email.me>
References: <tvmfk5$24jnf$1@dont-email.me> <20230325160209.2f932cab@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 25 Mar 2023 19:54:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1b8aadb0eddbb2441791993372ad0d94";
logging-data="2445225"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZklRArh1zyYVg1uhbwnjCZ+sFGK6A+6M="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:X59EqVnWseK0RS6aLb7dX2CLd7I=
In-Reply-To: <20230325160209.2f932cab@lud1.home>
Content-Language: en-US
 by: aotto1968 - Sat, 25 Mar 2023 19:54 UTC

On 25.03.23 20:02, Luc wrote:

>
> I don't know. Seems to me that you should rather go with two procs:
>
> proc usual {args} {
> do the usual
> }
>
> proc chameleon {args} {
> some odd job
> }
>
>
> One has to wonder if you really need that much flexibility though. It's
> reasonable to guess that you probably deal with few enough situations
> that you could have one proc (or switch clause inside one proc) for each
> particular case instead of rewriting procs on the fly. Do you even remember
> what those temporary procs do when you maintain your code?
> And if you need to know *when* the proc was changed to use or manage it,
> it sounds like you are skating on thin ice.
>

Well, there is something like a "driver-proc" doing the controlling job and this "driver" is calling multiple "worker-proc(s)"
to do the job. if I change the name of the "worker-proc" the "driver-proc" have to be updated as well → this is not good.

mfg ao

Re: missing feature in TCL

<e871be2d-5a98-40fc-ba80-68b0117bd24an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21596&group=comp.lang.tcl#21596

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1aa3:b0:72b:25b4:5660 with SMTP id bl35-20020a05620a1aa300b0072b25b45660mr3373301qkb.6.1679787962541;
Sat, 25 Mar 2023 16:46:02 -0700 (PDT)
X-Received: by 2002:ad4:58aa:0:b0:56e:c24b:58c6 with SMTP id
ea10-20020ad458aa000000b0056ec24b58c6mr1200988qvb.8.1679787962336; Sat, 25
Mar 2023 16:46:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sat, 25 Mar 2023 16:46:01 -0700 (PDT)
In-Reply-To: <tvnjgr$2ajt9$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=192.183.219.24; posting-account=f4QznQoAAAAjupLEpV87s_G-96g1Io1w
NNTP-Posting-Host: 192.183.219.24
References: <tvmfk5$24jnf$1@dont-email.me> <20230325160209.2f932cab@lud1.home> <tvnjgr$2ajt9$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e871be2d-5a98-40fc-ba80-68b0117bd24an@googlegroups.com>
Subject: Re: missing feature in TCL
From: bgriffinfortytwo@gmail.com (briang)
Injection-Date: Sat, 25 Mar 2023 23:46:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2963
 by: briang - Sat, 25 Mar 2023 23:46 UTC

On Saturday, March 25, 2023 at 12:54:07 PM UTC-7, aotto1968 wrote:
> On 25.03.23 20:02, Luc wrote:
>
> >
> > I don't know. Seems to me that you should rather go with two procs:
> >
> > proc usual {args} {
> > do the usual
> > }
> >
> > proc chameleon {args} {
> > some odd job
> > }
> >
> >
> > One has to wonder if you really need that much flexibility though. It's
> > reasonable to guess that you probably deal with few enough situations
> > that you could have one proc (or switch clause inside one proc) for each
> > particular case instead of rewriting procs on the fly. Do you even remember
> > what those temporary procs do when you maintain your code?
> > And if you need to know *when* the proc was changed to use or manage it,
> > it sounds like you are skating on thin ice.
> >
> Well, there is something like a "driver-proc" doing the controlling job and this "driver" is calling multiple "worker-proc(s)"
> to do the job. if I change the name of the "worker-proc" the "driver-proc" have to be updated as well → this is not good.
>
> mfg ao

When I write code that calls other procs that can be varied, I define the functions using variables, and the [apply] command to execute the functions. This way the proc(s) themselves can be passed to the "driver" by value. This still leaves you with the problem of identifying the source origin, but you do have more control over tracking where stuff came from. (See the [apply] command for details.)

The "info proc" additions would still be a nice feature to have. Just know that there are cases where there isn't any identifiable file/line for a proc.

-Brian

Re: missing feature in TCL

<tvop7a$2jb9q$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21598&group=comp.lang.tcl#21598

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sun, 26 Mar 2023 08:37:30 +0200
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <tvop7a$2jb9q$1@dont-email.me>
References: <tvmfk5$24jnf$1@dont-email.me> <20230325160209.2f932cab@lud1.home>
<tvnjgr$2ajt9$2@dont-email.me>
<e871be2d-5a98-40fc-ba80-68b0117bd24an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 26 Mar 2023 06:37:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d429f7773f85aa54332d842973517fa";
logging-data="2731322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/B9r+E4EoLNaLeQLGxTYpNlwc7jKBuBLE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:ZuzahPn9Pc+BiXff0KgSIYM4jVk=
In-Reply-To: <e871be2d-5a98-40fc-ba80-68b0117bd24an@googlegroups.com>
Content-Language: en-US
 by: aotto1968 - Sun, 26 Mar 2023 06:37 UTC

On 26.03.23 00:46, briang wrote:
> On Saturday, March 25, 2023 at 12:54:07 PM UTC-7, aotto1968 wrote:
>> On 25.03.23 20:02, Luc wrote:
>>
>>>
>>> I don't know. Seems to me that you should rather go with two procs:
>>>
>>> proc usual {args} {
>>> do the usual
>>> }
>>>
>>> proc chameleon {args} {
>>> some odd job
>>> }
>>>
>>>
>>> One has to wonder if you really need that much flexibility though. It's
>>> reasonable to guess that you probably deal with few enough situations
>>> that you could have one proc (or switch clause inside one proc) for each
>>> particular case instead of rewriting procs on the fly. Do you even remember
>>> what those temporary procs do when you maintain your code?
>>> And if you need to know *when* the proc was changed to use or manage it,
>>> it sounds like you are skating on thin ice.
>>>
>> Well, there is something like a "driver-proc" doing the controlling job and this "driver" is calling multiple "worker-proc(s)"
>> to do the job. if I change the name of the "worker-proc" the "driver-proc" have to be updated as well → this is not good.
>>
>> mfg ao
>
> When I write code that calls other procs that can be varied, I define the functions using variables, and the [apply] command to execute the functions. This way the proc(s) themselves can be passed to the "driver" by value. This still leaves you with the problem of identifying the source origin, but you do have more control over tracking where stuff came from. (See the [apply] command for details.)
>
> The "info proc" additions would still be a nice feature to have. Just know that there are cases where there isn't any identifiable file/line for a proc.
>
> -Brian

I don't understand where is the advantage of overwrite and call a variable as lambda in difference of overwrite and call a proc.
With a proc you have still the possible (as mentioned up) to get extra attributes like source,line etc

-ao

Re: missing feature in TCL

<77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21602&group=comp.lang.tcl#21602

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:4d4e:0:b0:56e:9f09:ee58 with SMTP id m14-20020ad44d4e000000b0056e9f09ee58mr1506397qvm.8.1679824706749;
Sun, 26 Mar 2023 02:58:26 -0700 (PDT)
X-Received: by 2002:a37:ab09:0:b0:745:c8e5:7b28 with SMTP id
u9-20020a37ab09000000b00745c8e57b28mr3473004qke.2.1679824706546; Sun, 26 Mar
2023 02:58:26 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 26 Mar 2023 02:58:26 -0700 (PDT)
In-Reply-To: <tvmfk5$24jnf$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ee:9737:1f00:5877:cf2a:c5ab:c27c;
posting-account=IpC1pwoAAACCAmF-qbg4PWxvUAd-j7Tc
NNTP-Posting-Host: 2003:ee:9737:1f00:5877:cf2a:c5ab:c27c
References: <tvmfk5$24jnf$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>
Subject: Re: missing feature in TCL
From: molecool1058@googlemail.com (Mole Cool)
Injection-Date: Sun, 26 Mar 2023 09:58:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1418
 by: Mole Cool - Sun, 26 Mar 2023 09:58 UTC

Hi, most of the stuff you require is available in the ‚info‘ command, the filename you can get on source. Of course only for a unique proc name.

I really have no clue what you try to accomplish, but a namespace would not help here?

Re: missing feature in TCL

<tvp5rp$2lesl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21604&group=comp.lang.tcl#21604

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sun, 26 Mar 2023 12:13:13 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <tvp5rp$2lesl$1@dont-email.me>
References: <tvmfk5$24jnf$1@dont-email.me>
<77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 26 Mar 2023 10:13:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d429f7773f85aa54332d842973517fa";
logging-data="2800533"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197k6DekPEqbs58fdqNoV2FHFsbBWl1RmU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:bkd6XK/QyaxvZefR+aISaxM4X5U=
In-Reply-To: <77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>
Content-Language: en-US
 by: aotto1968 - Sun, 26 Mar 2023 10:13 UTC

On 26.03.23 11:58, Mole Cool wrote:
> Hi, most of the stuff you require is available in the ‚info‘ command, the filename you can get on source. Of course only for a unique proc name.
>
> I really have no clue what you try to accomplish, but a namespace would not help here?

Hi,

the file filename a *proc* is defined is *not* the same a filename when *proc* is used.
the *info* command I get the the filename when *proc* is used,

-ao

Re: missing feature in TCL

<642efbd9-7e8d-4357-84e0-b0af6f63e38dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21605&group=comp.lang.tcl#21605

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1914:b0:743:82f9:cc0d with SMTP id bj20-20020a05620a191400b0074382f9cc0dmr1887003qkb.15.1679826380379;
Sun, 26 Mar 2023 03:26:20 -0700 (PDT)
X-Received: by 2002:a05:6214:8d2:b0:570:f1a0:996f with SMTP id
da18-20020a05621408d200b00570f1a0996fmr1237860qvb.2.1679826380132; Sun, 26
Mar 2023 03:26:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 26 Mar 2023 03:26:19 -0700 (PDT)
In-Reply-To: <tvp5rp$2lesl$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ee:9737:1f00:5877:cf2a:c5ab:c27c;
posting-account=IpC1pwoAAACCAmF-qbg4PWxvUAd-j7Tc
NNTP-Posting-Host: 2003:ee:9737:1f00:5877:cf2a:c5ab:c27c
References: <tvmfk5$24jnf$1@dont-email.me> <77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>
<tvp5rp$2lesl$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <642efbd9-7e8d-4357-84e0-b0af6f63e38dn@googlegroups.com>
Subject: Re: missing feature in TCL
From: molecool1058@googlemail.com (Mole Cool)
Injection-Date: Sun, 26 Mar 2023 10:26:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1556
 by: Mole Cool - Sun, 26 Mar 2023 10:26 UTC

But if you rename ‚source‘ you can have a pre and post command to see which procs a new and defined in the file, and the last one is the active one. Again, a renamed proc which will jump in the required namespace would for me the best. But you know the details 😉

Re: missing feature in TCL

<tvpo1b$2oflm$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21611&group=comp.lang.tcl#21611

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature in TCL
Date: Sun, 26 Mar 2023 15:23:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 81
Message-ID: <tvpo1b$2oflm$1@dont-email.me>
References: <tvmfk5$24jnf$1@dont-email.me> <77e46e91-393a-4acb-aaea-ecf948a47f20n@googlegroups.com>
Injection-Date: Sun, 26 Mar 2023 15:23:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c9f82d72910fc473ea44df25d95f7d12";
logging-data="2899638"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VKiBktVweUq3qyrsyEhdv"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:vO+pANf0Zvt6gB2gTHJHtTLC/oc=
 by: Rich - Sun, 26 Mar 2023 15:23 UTC

Mole Cool <molecool1058@googlemail.com> wrote:
> I really have no clue what you try to accomplish, but a namespace
> would not help here?

I am also quite confused as to what the OP is trying to accomplish.

As best I understand from the vague descriptions given so far, it seems
that the OP has an initial 'proc', say 'caller' which calls a second
('worker') to perform some task.

I.e.:

proc caller {arg1 arg2} {
set result [worker $arg2]
...
}

And the OP wants to swap out different 'workers' for some reason such
that which worker is actually called differs based on some condition.

So they have something like this:

proc swap_worker {arg} {
switch -exact -- $arg {
worker-1 {
proc worker {arg} {
...
}
}
worker-2 {
proc worker {arg} {
... (different body from worker-1)
}
}
}
}

And they call "swap_worker 0" and/or "swap_worker 1" as needed to
"change the definition of 'worker'. Although I suspect from other
vague descriptions by the op that my "proc worker" examples in the
switch above are actually "source worker-1.tcl" and "source
worker-2.tcl" instead.

So, if this is what they are trying to do (and I don't know that it is,
this is just what I've come up with by trying to "fill in the gaps"
left by OP's vague description) then namespaces might be a solution
to what they want that they have not tried yet.

Namespaces allow creation of 'ensemble' commands. And each 'ensemble'
itself has a "-map" which can optionally be setup to provide custom
mapping of externally visible names to internal destination names
within the ensemble.

So the OP could setup a namespace with two (or more) 'worker'
implementations inside. Then configure an ensemble to call one of the
'workers' (by appropriate -map setup). And later, when OP wants to
swap "worker" implementation without changing callers, OP simply
re-configures the -map for the ensemble to call the other worker inside
the namespace ensemble.

So OP's 'caller' would look like this:

proc caller {arg1 arg2} {
set result [my-project do-work $arg2]
...
}

Then, by adjustment of the -map configuration for the 'my-project'
ensemble, the 'do-work' sub-command can call either of
'my-project::worker-1' or 'my-project::worker-2' at different times.

Achieving the same results as "replacing" 'worker' with a new 'worker'
proc.

And, the OP can simply introspect the -map to see which internal proc
was being called at any given time. It is also possible that in the
case of errors (which IIRC seemed to be OP's initial ask) that Tcl
itself would report the actual used internal proc name for the
destination of the ensemble. And if not, OP would just need to [catch]
or [try] the call, then query the -map before outputting a custom error
message to report "which proc was used at the time of the call".


devel / comp.lang.tcl / missing feature in TCL

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor