__FILE__ and __LINE__ in case of import expression
Steven Schveighoffer
schveiguy at gmail.com
Fri Aug 21 22:12:48 UTC 2020
On 8/21/20 5:56 PM, Adam D. Ruppe wrote:
> On Friday, 21 August 2020 at 21:42:21 UTC, Steven Schveighoffer wrote:
>> While not necessarily a "bug", it's not very useful.
>
> Maybe not in this case, but it is perfectly accurate for cases like:
>
> mixin(q{
> some code here
> });
>
> Where it will actually line back up to the original file's line number
> perfectly.
>
>
Who does that though? Why not just write "some code here" right in the
file? (I know that the string interpolation DIP might make this more likely)
And honestly, if it says the source is "mixin-50, line 1", I think
people will get it.
Whereas, if the code is like:
mixin(generateTheMixin());
and it says the line is 67, and line 67 has nothing to do with the mixin
source or the location it's mixed in, but instead, you need to subtract
the line number of mixing in from 67 to get the *real* line number, I
think the utility is really gone at that point.
-Steve
More information about the Digitalmars-d-learn
mailing list