Hello D programmers,
I'm blocked by a mysterious segfault I seem to be unable to diagnose. There is probably some point of D I have not yet understood. Below relevant piece of code; "***" marks debug instructions. The constructor works fine, assertions pass, and writeln writes: ([0-9]+ ("+" [0-9]+)*) But when I call the method 'check', writeln writes (null null) Which means that this.pattern's sub-patterns have disappeared. See line constructing this.pattern in constructor to have an idea (I even tried to replace sep & element by this.sep & this.element, but this does not help). When matching with this.pattern later in check(), I get a segfault because the code tries to recursively match its sub-patterns (the null items). Denis class List : Pattern { // ... Pattern element; Pattern sep; Tuple pattern; uint min; this (Pattern element, Pattern sep, uint min=2) { this.min = min; // for output this.element = element; this.sep = sep; // construct pattern this.pattern = new Tuple( element, new ZeroOrMore(new Tuple(sep,element)) ); assert ((this.element !is null) && (this.sep !is null)); // *** assert (this.pattern !is null); // *** writeln(this.pattern); // *** } override Result check (Source source) { assert (this.pattern !is null); // *** writeln(this.pattern); // *** // ... -- -- -- -- -- -- -- vit esse estrany ☣ spir.wikidot.com