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 stay in safety and choose this way:
```d
enum _LOCATION_(string FILE=__FILE__, size_t LINE=__LINE__) =
FILE~'('~LINE.text~",1)";
enum loc1 = (_LOCATION_!());
enum loc2 = (_LOCATION_!());
```
We just can't eliminate the !() with alias, it's mandatory.
And I write this signature `(_LOCATION_!())` to every place where
it is needed. But not by myself, by my machine. It will be
hidden in my editor to reduce visual noise.
Maybe I can make it more type-safe by not returning a string
`"file.d(12,1)"`, but returning a struct. Howerer IES also
starts and ends with special structs, easy to detect those.