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
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
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.
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
On Saturday, March 25, 2023 at 12:54:07 PM UTC-7, aotto1968 wrote: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.)
On 25.03.23 20:02, Luc wrote:
Well, there is something like a "driver-proc" doing the controlling job and this "driver" is calling multiple "worker-proc(s)"
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.
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 "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
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?
I really have no clue what you try to accomplish, but a namespace
would not help here?
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 716 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 49:08:27 |
| Calls: | 12,115 |
| Calls today: | 6 |
| Files: | 15,010 |
| Messages: | 6,518,535 |