Is it possible to embed the file path and line num...
# compiler
c
Is it possible to embed the file path and line number at compile-time? Something like
__FILE__
and
__LINE__
in C. The goal is to have a function that measures the performance of some code, and is able to report it with a link to its call, for ease of debugging. I know it's possible to get that information by throwing an exception, catching it and exploring the stacktrace, but that would have a performance impact, whereas this should be able to be embedded at compile-time to avoid any performance difference.
e
.main.kts
already supports
__FILE__
, although it's handled as a
val
that the script runner supplies at runtime
o
c
Thanks!