June 24, 2012 Re: Made a Rage-Comic about D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Saturday, 23 June 2012 at 23:37:11 UTC, Jonathan M Davis wrote: > On Saturday, June 23, 2012 13:46:51 David wrote: >> The cool thing is, I wasn't able to track it down until now, since line >> numbers are completly messed up because of a heavy use of mixin() and CTFE. > > Which is why I _never_ put newlines in string mixins. > > - Jonathan M Davis #line is a godsend when working with string mixins. mixin(`#line ` ~ (30_000 + __LINE__).stringof ~ ` // Some really long code here // The line numbers will be correct but plus 30_000 // Making it fairly simple to debug. `); -- Robert http://octarineparrot.com/ | |||
June 24, 2012 Re: Made a Rage-Comic about D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | > #line is a godsend when working with string mixins. > > mixin(`#line ` ~ (30_000 + __LINE__).stringof ~ ` > // Some really long code here > // The line numbers will be correct but plus 30_000 > // Making it fairly simple to debug. > `); > > -- > Robert > http://octarineparrot.com/ Actually, add another 1 to that, my bad! -- Robert http://octarineparrot.com/ | |||
June 24, 2012 Re: Made a Rage-Comic about D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | On Sunday, 24 June 2012 at 00:08:27 UTC, Robert Clipsham wrote:
> // The line numbers will be correct but plus 30_000
You shouldn't do it with that value in std.datetime, though… :P
David
| |||
June 24, 2012 Re: Made a Rage-Comic about D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert Clipsham | Am 24.06.2012 02:09, schrieb Robert Clipsham:
>> #line is a godsend when working with string mixins.
>>
>> mixin(`#line ` ~ (30_000 + __LINE__).stringof ~ `
>> // Some really long code here
>> // The line numbers will be correct but plus 30_000
>> // Making it fairly simple to debug.
>> `);
>>
>> --
>> Robert
>> http://octarineparrot.com/
>
> Actually, add another 1 to that, my bad!
>
> --
> Robert
> http://octarineparrot.com/
Nice workaround, but I hope there will be sometime a proper solution in DMD :/
*dreams*
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply