In a templated class (D1.0) along lines ... class Foo(T) { //.. static T bar() { return T.init; } //.. }
Foo!(int).bar() returns 0 and Foo!(char[]).bar() returns nil. I'd much prefer (at least for my purposes) that (char[]).init returned an empty string rather than effectively a null pointer. Is there a convenient solution for this, e.g. by specializing just the bar method of class Foo when T is char[], or by some other means? Maybe this type of question best be asked on D.learn, but I do wonder if an empty string is a more reasonable initializer for char[] .. well maybe not .. I don't know .. I yield to your sensibilities. Thanks to all.