Disable GC entirely

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 10 11:26:03 PDT 2013


On 4/10/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> On 4/10/13 1:33 PM, Manu wrote:
>>     It may as well be a mistake that nonvirtual functions are at all
>>     part of a class' methods. This has been quite painfully seen in C++
>>     leading to surprising conclusions: http://goo.gl/dqZrr.
>>
>>
>> Hmm, some interesting points. Although I don't think I buy what he's
>> selling.
>
> That article ain't sellin'. It's destroyin'.

UFCS can't be the penultimate solution, for example:

class S(T)
{
    alias Type = SomeTypeModifier!T;

    static if (isSomePredicate!Type)
    {
        int x;
        void foo() { /* do something with x */ }
    }
    else
    {
        float y;
        void bar() { /* do something with y */ }
    }
}

How do you implement this with UFCS? It wouldn't look nice if you had
to put those methods outside, while keeping the data inside. You'd
have to duplicate static ifs outside and inside the class.


More information about the Digitalmars-d mailing list