title: “EXCEPTION::CURRENT_FUNC Function” date: 2025-09-11 author: “laplante@plcb.ca” version: “1.0.1”
*exception::current_func — return the current function or a specific function from the call stack
The exception::current_function
function returns the current executing function.
If an integer is specified, it returns the corresponding function in the call stack, starting at index 0 for the current function.
res={{
func f2() {
current_func();
"In f2";
current_func();
}
func f1() {
current_func();
f2();
current_func();
}
func f4() {
current_func();
"In f4";
current_func();
return null;
}
func f3() {
current_func();
f4();
current_func();
}
f1();
f3();
}}.
return
res=f1f2In f2f2f1f3f4In f4f4f3.
res={{
func f2() {
f3();
}
func f1() {
f2();
}
func f4() {
current_func();
current_func(0);
current_func(1);
current_func(2);
current_func(3);
}
func f3() {
f4();
}
f1();
}}.
return
res=f4f4f3f2f1.
1.0.1 — 2025-09-11 — camelCase (laplante@plcb.ca)
1.0.0 — 2023-11-30 — Initial version by laplante@plcb.ca
exception::current_func([integer])
current_func([integer])
The exception::current_function
function returns the current executing function.
If an integer is specified, it returns the corresponding function in the call stack, starting at index 0 for the current function.
res={{
func f2() {
current_func();
"In f2";
current_func();
}
func f1() {
current_func();
f2();
current_func();
}
func f4() {
current_func();
"In f4";
current_func();
return null;
}
func f3() {
current_func();
f4();
current_func();
}
f1();
f3();
}}.
return
res=f1f2In f2f2f1f3f4In f4f4f3.
res={{
func f2() {
f3();
}
func f1() {
f2();
}
func f4() {
current_func();
current_func(0);
current_func(1);
current_func(2);
current_func(3);
}
func f3() {
f4();
}
f1();
}}.
return
res=f4f4f3f2f1.