foo() calls bar(), which in turn calls std.debug.assert() with a false condition… is there way to just report the call-site inside foo()???
standing backing, i’m doing a lot of “semantic validation” inside functions i provide… ideally, i would be able simply report the @src() infomation about my caller…
some of this validation can actually be done at comptime; but in some cases function parameter values aren’t known until runtime… either way, i’d like these to “look-and-feel” as much as possible like standard compiler errors…
I wonder if you could do something by forcing an inline to achieve this (of course there’s other concerns about whether you would want to inline… just throwing out ideas here).
exactly… just like the sort of message i receive from the compiler were i to call foo() with the wrong number and types of arguments…
even @comptimeError would benefit from this feature…
indeed, we’ve seen plenty of examples in which an anytype parameter undergoes further semantic analysis… likewise when we want to verify that a particular pattern is being followed, etc.
in general, imposing a “design-by-contract” veneer onto one’s code often finds it implementation via assert statements (for function pre- and post-conditions)…
I don’t ascribe to the techniques there in my own code for Zig anymore, but there was a lot of great thinking and you might have some more insight into building a better mousetrap.