I’ve added a new global function for this:
CurrentMethodName() As String
It returns the currently executing ObjoBasic method, function, event, or script frame name without needing to raise an exception.
For example:
Class App Inherits CommandLineApplication
Event Run(args() As String) As Integer
Print(CurrentMethodName()) # App.Run
Return 0
End Event
End Class
And inside a normal class method:
Class Worker
Function Trace() As String
Return CurrentMethodName()
End Function
End Class
Var worker As New Worker
Print(worker.Trace()) # Worker.Trace
This is intended for tracing, timing, logging, and diagnostics where you want the active method name during normal execution.
RuntimeException.StackFrames is still the right API when you are handling an exception and want the full call stack at the throw site. As part of this work, stack frame names now also use the same qualified, user-facing names where possible.
This has been implemented and will be available in the next build: https://feedback.objo.dev/feature/515