On Tuesday, 2 June 2015 at 06:42:13 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 2 June 2015 at 06:32:43 UTC, Jonathan M Davis wrote:
D's semantics for __FILE__ and __LINE__ are so much better
than C++'s. I sorely miss D's semantics for them whenever I'm
in C++. Having them get the values from the call site rather
than the declaration site is so much more useful that it's not
even funny.
But you are referring to evaluation of default parameters.
Evaluating default parameters at the call site can be
problematic, so I don't think this is obvious at all.
All functions have a conceptual object which is the "activation
record", often represented by the stack frame (but in some
languages a heap object). It would be reasonable to be able to
query this "activation record" object, just like you have
"this" that refers to the object of a method you could have a
"thisfunction.caller.lineno" etc.
That would be even greater if they would be chained ! What a
debug tool we could get out of this ! I know ! We should call
them "stack traces" ! Catchy !