<p dir="ltr">On 25 Mar 2016 7:00 am, "cy via Digitalmars-d" <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br>
><br>
> I've been working for 3 days straight on this: the monumental task of taking these text files and turning them into HTML. Or should I say, FML, because FML. Why is this so hard?<br>
><br>
> My code is peppered with writelns and sanity checks, none of which show anything alarming until long after the document gets a self referential cycle in it, and apparantly this is happening by "creating a child and appending it to a node." Obviously that's a rare and obscure operation, that nobody ever would think of doing.<br>
><br>
> I can't do any introspection. GDB just goes belly up with DIE errors. Trying to get non-broken DWARF information by switching to GDC, GDC goes belly up with "internal error, please submit a bug report" and the reason for this error is creating a module named "cross.iter" and adding a sixth exported symbol to it.<br>
></p>
<p dir="ltr">Have you considered raising a bug report as the compiler asks?</p>
<p dir="ltr"><a href="http://bugzilla.gdcproject.org/">http://bugzilla.gdcproject.org/</a></p>
<p dir="ltr">It will never get noticed or fixed otherwise.<br></p>
<p dir="ltr">> In reflection, what would be really nice is:<br>
> * some way to trace function calls, to see the order of calls before the program died.</p>
<p dir="ltr">It's called stack trace, uncaught exceptions print this information out.<br></p>
<p dir="ltr">> * a backtrace that displays when you hit ^C, instead of just silent death</p>
<p dir="ltr">This is something that you can do with signal handlers.</p>
<p dir="ltr">> * DWARF debugging symbols that don't scramble the only program on earth that actually uses them.</p>
<p dir="ltr">There's more than one dwarf reader, but yeah dmd has many small things lacking that mount up as you get more complex.</p>
<p dir="ltr">> * some way to signal the program to dump the stack frames of its threads to a log</p>
<p dir="ltr">Again, use OS signal handlers?</p>
<p dir="ltr">> * better ways to report program status besides writeln("we got here somehow");</p>
<p dir="ltr">I'm afraid to say that only you can improve your own printf messages.</p>
<p dir="ltr">> * catching null pointer errors earlier, instead of waiting until you 1) call the class function and 2) the function accesses a member.</p>
<p dir="ltr">etc.linux.memoryerror - you can use that for catching SIGSEGV and dumping stacktrace.</p>
<p dir="ltr">I'd suggest that you do the same for other signals such as SIGKILL and SIGTERM.</p>
<p dir="ltr">> * ways to ensure that nothing is being copied, if you accidentally write a wrapper that creates an object instead of referencing it, or moving it.</p>
<p dir="ltr">Use @disable this(this); in your structs.</p>
<p dir="ltr">> * better const support, so can minimize the amount of mutable data involved here</p>
<p dir="ltr">In the library or in your program?  Last time I checked phobos still has some way to go on that front.</p>
<p dir="ltr">But granted that const is transitive, you should introduce it in a bottom up fashion.  First find all leaf functions and make them const, then work your way up from there.</p>
<p dir="ltr">> * it would be nice to be able to return an iterator whose elements are either const or not const, using inout, instead of having to write the function twice.</p>
<p dir="ltr">This should be very possible, but I wouldn't know where you are going wrong.</p>
<p dir="ltr">> * it would also be nice to be able to return references, instead of copying structs every time, or writing wrappers around them (which also cannot be used with inout)</p>
<p dir="ltr">ref MyStruct() { return s; }</p>
<p dir="ltr">I've never tried mixing ref and inout before, so won't attempt it here.</p>
<p dir="ltr">> * heap allocated structs, stack allocated classes, it would be nice to have allocation strategy independent from layout strategy.</p>
<p dir="ltr">Use pointer to structs and scope classes.</p>
<p dir="ltr">> * less people writing complex allocating functions as their struct init property, and then leaving me wondering how that could possibly be invariant.</p>
<p dir="ltr">I can not ask the hundreds of contributors to stop the fantastic work they are doing.</p>
<p dir="ltr">> * a pony</p>
<p dir="ltr">Of all points above, this is one that can actually be arranged.  No joke!<br>
</p>