On Thursday, 25 April 2019 at 08:44:14 UTC, Dennis wrote:
On Monday, 22 April 2019 at 16:24:53 UTC, Taylor Hillegeist
wrote:
Or would this not be easy at all with D?
I don't think so. While there are lots of traits for
introspection of declarations, there is no way to introspect
lines of code. The whole function
would need to be wrapped into a mixin, and the D code would
need to be parsed
at compile time for this to work.
Yes, but I think that might be doable. You wouldn't need a full
blown D parser, just one that can identify statements (`;` being
an important clue). Not sure whether __LINE__ will be meaningful
inside a mixin, though, but that might also be fixable. It would
be an interesting challenge.
Bastiaan.