T.D.Spenser:

> Here is a version with a main function and sample file to parse:

Good. Your code looks good, well formatted and readable.
But before you try to optimize code you have write some tests, otherwise you 
can't be sure you are not breaking the code, it's like driving with closed 
eyes. D has both unittests and design by contract, add them (it's also a good 
training in using such important things). I will try to look at your code even 
without that necessary safety net, but I can't be sure I am not breaking your 
code, so I hope you will give me some tests&contracts too.


> Although, the files it spits out are quite strange.

I think they are normal enough for a profiler. GCC produces a not too much 
different file.

Notes on your code:

Is this a critique of the D way to tell if an object is of a class? :-)

auto childTag = cast(TagNode) child;
if (childTag !is null && childTag.getName() == name) { //tricky, since cast is 
used to check type


In D you may have many constructors, so what were you trying to do here?

public this(string name, Node[] children...) { //can't have two constructors 
like in Java

Bye,
bearophile

Reply via email to