https://issues.dlang.org/show_bug.cgi?id=17593

Vladimir Panteleev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net

--- Comment #1 from Vladimir Panteleev <[email protected]> ---
I think such an enhancement could use some more background.

When would you find it useful, and how are the existing tools insufficient to
warrant a change in the language?

Right now, you can use:

- string mixins, i.e.:
    Pos pos = mixin(mixPos);
  where
    enum mixPos = q{ Pos(__FILE__, __MODULE__, __LINE__) };

- The property of __FILE__/__LINE__ etc. that as default arguments, they are
evaluated at the call site:
    Pos pos = getPos();
  where
    Pos getPos(string f=__FILE__, string m=__MODULE__, int l=__LINE__)
    { return Pos(f, m, l); }

- As above, but also for template arguments, not just runtime function
arguments:
    Pos pos = currentPos!();
  where
    enum Pos currentPos(string f=__FILE__, string m=__MODULE__, int l=__LINE__)
= Pos(f, m, l);

(I haven't tested the above, but I think they should work.)

--

Reply via email to