Disable GC entirely

Rob T alanb at ucora.com
Tue Apr 9 11:29:17 PDT 2013


On Tuesday, 9 April 2013 at 16:49:04 UTC, Manu wrote:
>>>
>>>
>> final class Foo{ //no inheritance
>> final: //no virtuals
>> ...
>> }
>>
>> 2 extra words and you are done. The only problem I see is that 
>> there is no
>> way to "undo" final on a few methods later...

final class Foo
{
    final //no virtuals
    {
       ...
    }

    // final ends, virtual methods below?
    ....
}

>
> And any junior/tired/forgetful programmer will
> accidentally write slow code all over the place, and nobody 
> will ever have
> any idea that they've done it. It's very dangerous.

I suppose, OTOH forgetting to make methods virtual can lead to 
another problem.

In general, perhaps we're still talking about the same problem as 
with how to ensure that portions of code do not contain unwanted 
features of the language. If you want to ban the use of virtual 
functions, there ought to be a way to do it easily, same for 
writing code that does not contain features of the language that 
require a GC, etc.

--rt


More information about the Digitalmars-d mailing list