formattedWrite writes nothing
Andrej Mitrovic via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 2 03:22:51 PDT 2014
On 5/2/14, ref2401 via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:
> class MyClass {
> Appender!string _stringBuilder;
>
> this() {
> _stringBuilder = Appender!string(null);
> _stringBuilder.clear();
Ouch, ouch, ouch! What's happening is that the 'clear' Appender method
is only compiled-in if the data is mutable, otherwise you end up
calling the object.clear UFCS function. So don't use clear here.
I don't know if this is a case of poor method naming or another
downside of UFCS. Luckily 'clear' is being renamed to 'destroy' in the
object module, so this specific case will not become a problem in the
future.
More information about the Digitalmars-d-learn
mailing list