Phobos: __FILE__ as template default parameter
Simen Kjaeraas via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 20 09:33:43 PDT 2016
On Monday, 20 June 2016 at 14:28:06 UTC, Jacob Carlborg wrote:
>
> Would it be a bad idea to allow this in the compiler:
>
> void foo(Args...)(Args args, string file = __FILE__, size_t
> line = __LINE__);
>
> It wouldn't be possible to pass "file" or "line" when calling
> "foo". But it's useful for the special default values, __FILE__
> and __LINE__.
I very much agree with this idea. Like with the current system of
forwarding to a function with explicit file and line run-time
arguments, a function can be made accessible that has them as
explicit parameters for those cases when you want to pretend to
be somewhere you're not. :p
--
Simen
More information about the Digitalmars-d
mailing list