Stream.opApply and invariance
Lionello Lunesu
lio at lunesu.remove.com
Sat Apr 5 00:23:49 PDT 2008
This one bugs me as well. The reason is that opApply uses readLine,
which in turn calls readLine(char[]), reusing the passed buffer. This
will never return an invariant string, and the result must therefor
always be idup'ed :-((
I don't think there's anything that can be done to 'fix' this. readLine
must write to the buffer, so it's never invariant. Casting to invariant
is not possible, as it would break all the guarantees. I wonder if
there's something that can be done by using an "invariant constructor"
mentioned in Andrei's PDF (see Walter's post in the other group.)
L.
More information about the Digitalmars-d-learn
mailing list