On 5/2/14, ref2401 via Digitalmars-d-learn
<digitalmars-d-learn@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.

Reply via email to