Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to get the name of the current procedure

24 views
Skip to first unread message

Cecil Westerhof

unread,
Nov 21, 2017, 8:14:05 AM11/21/17
to
In Bash I can use ${FUNCNAME} to get the name of the current function.
Does TCL has something like that to get the name of the current
procedure?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Ricardo kozmate.net

unread,
Nov 21, 2017, 8:32:49 AM11/21/17
to
Em 21/11/17 13:01, Cecil Westerhof escreveu:
> In Bash I can use ${FUNCNAME} to get the name of the current function.
> Does TCL has something like that to get the name of the current
> procedure?
>

Maybe [info frame 0]? The output is a dictionary, so this proc:

proc test {} {
puts <testStart>
set dic [info frame 0]
puts $dic
puts [dict get $dic proc]
puts <testEnd>
}

runs like:

tcl> test
<testStart>
type proc line 3 cmd {info frame 0} proc ::test level 0
::test
<testEnd>
tcl>


Or maybe something else on the [info] command, there is a lot of
introspection going on there.


(and wait some more, there a some real experts here, I am NOT one for
sure :)
--
{ricardo from kozmate.net}

Arjen Markus

unread,
Nov 21, 2017, 8:49:36 AM11/21/17
to
[info level 0] may be simpler to use - it gives a list of the procedure name and its arguments.

Regards,

Arjen

Cecil Westerhof

unread,
Nov 21, 2017, 9:28:06 AM11/21/17
to
That is what I need. And I should delve deeper in it also, because it
looks like it can be a very interesting command.
0 new messages