On Wednesday, February 12, 2020 at 9:59:26 PM UTC+1, pd wrote:
> Yes, I've checked it and I have a lremove proc, is there any way to know how it gets loaded? what file or package is loading it?
While this seems resolved for lremove (and because Tcl is cool), you can rewrite [proc]. For an even more general approach, note that lremove could also be an ensemble or an alias. But for now let's assume you are really looking at a proc, i.e. it is listed by [info procs].
Before loading any other code, inject this hack:
# untested
rename proc proc_native
proc_native proc {name arglist body} {
if {$name in {lremove}} {
return -code error "$name is defined as {[info level 0]}, see the stack trace."
# if the caller catches this, this is another option
puts stderr "some message"
exit 1
}
uplevel 1 [list proc_native $name $arglist $body]
}