[Issue 1211] mixin("__LINE__") gives incorrect value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 5 06:27:30 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1211
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
Keywords| |wrong-code
Summary|mixin("__LINE__") |mixin("__LINE__") gives
| |incorrect value
------- Comment #2 from smjg at iname.com 2007-05-05 08:27 -------
> writef("%\n", mixin(string)); // 1, 3 or 4? what about generated strings?
What is %\n? And how is 3 a plausible value in your example?
> how about a dotted form?
>
> <mixin_line>.<line_in_mixin>
Then how would we distinguish between 2.1 and 2.10?
IMO it should be the line in which it's mixed in, as that's the first point at
which __LINE__ is treated as a token rather than being in a string. If you
want the line where __LINE__ actually is in the code, you'd have to use
writef("%d\n", mixin(string)); // BTW what is %\n???
const char[] string = "
" ~ __LINE__.stringof;
This leaves:
- the line within the mixed-in code - if we're going to have this, it should
probably be by a different token such as __MIXIN_LINE__.
- the line at which it would appear in the code after expansion of the mixin -
but I don't see any practical use for this.
--
More information about the Digitalmars-d-bugs
mailing list