On Wednesday, 28 May 2025 at 10:13:43 UTC, realhet wrote:
On Tuesday, 27 May 2025 at 21:16:57 UTC, monkyyy wrote:
On Tuesday, 27 May 2025 at 21:07:51 UTC, realhet wrote:

I've found a way to eliminate !() by using a function:

```d
struct LOCATION_t2
{
    string location;
    string toString() const => location;
}

auto LOC2(string FILE=__FILE__, size_t LINE=__LINE__)
=> LOCATION_t2(FILE~'('~LINE.text~",1)");

pragma(msg, LOC2);                              
//LOCATION_t2("onlineapp.d(28,1)")
pragma(msg, LOC2.text);                 //onlineapp.d(29,1)
pragma(msg, i"$(LOC2)"); //AliasSeq!(InterpolationHeader(), InterpolatedExpression(), LOC2, InterpolationFooter()) //!no line number pragma(msg, i"$(LOC2)".text); //onlineapp.d-mixin-31(31,1) //!!line number is still there!

```

Also encapsulating it in a struct, so it's safer because (LOCATION_t2 != string).

I love this LEGO set :]

Reply via email to