debugging mixins

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 5 15:09:29 PDT 2016


On Wednesday, 5 October 2016 at 02:45:53 UTC, Stefan Koch wrote:
> On Tuesday, 4 October 2016 at 01:59:11 UTC, Stefan Koch wrote:
>> On Tuesday, 4 October 2016 at 01:20:01 UTC, Manu wrote:
>>> On 4 October 2016 at 04:21, Stefan Koch via Digitalmars-d 
>>> <digitalmars-d at puremagic.com> wrote:
>>>> On Monday, 3 October 2016 at 15:23:40 UTC, Jonathan Marler 
>>>> wrote:
>>>>
>>>>>
>>>>> Yes, having the mixins expanded without the surrounding 
>>>>> code would make it difficult to debug in some cases.  Maybe 
>>>>> generating the entire source with the expanded mixins is 
>>>>> another option?
>>>>>
>>>>> mycode.d
>>>>> obj/mycode_processed.d
>>>>
>>>> That was my intention.
>>>>>
>>>>> Maybe this idea could also be expanded to template 
>>>>> instantiation?
>>>>
>>>>  Oh yes. it is not that more much work :)
>
> A small update on this.
> The POC works rather well ...
> Except for cases of massive template recursion. (binderoo and 
> most of std.traits)
> In such cases a stack overflow occurs inside the prettyPrinter.
>
> I am trying to find a work-around.

The simplest workaround is to run recursion heavy code in a fiber 
with large stack size (e.g. 64MB).

// before
auto newExpr = expr.ctfeInterpret();  // some recursion heavy code

// after	
Expression newExpr;
	
import core.thread : Fiber;	
new Fiber(
{
      newExpr = expr.ctfeInterpret();  // some recursion heavy code
}, 64 * 1024 * 1024).call();




More information about the Digitalmars-d mailing list