Uphill
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 1 23:42:12 PDT 2015
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.
More information about the Digitalmars-d
mailing list