What are the worst parts of D?

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 6 09:43:29 PDT 2014


Am 06.10.2014 10:12, schrieb eles:
> On Monday, 6 October 2014 at 06:28:58 UTC, eles wrote:
>> On Monday, 6 October 2014 at 06:28:02 UTC, eles wrote:
>>> On Monday, 6 October 2014 at 06:23:42 UTC, eles wrote:
>>>> On Monday, 6 October 2014 at 03:48:49 UTC, Andrei Alexandrescu wrote:
>>>>> On 10/5/14, 3:08 PM, eles wrote:
>>>>>> On Sunday, 5 October 2014 at 14:55:38 UTC, Dicebot wrote:
>>
>> I like the safety that a GC guarantees, but is a too big price to
>> be paid for that...
>
> Just look at this abomination from here:
>
> http://agilology.blogspot.com/2009/01/why-dispose-is-necessary-and-other.html
>
>
> sqlConnection.Close();
> sqlConnection.Dispose();
> sqlConnection = null;
>
> Is this your idea about releasing a resource? Why is this better than
> writing delete/dispose sqlConnection?
>
> If you ask to use structs for RAII, I am afraid that you will receive a
> DFront proposal.

This abomination tends to be written by developers that don't care to 
learn how to use properly their tools.

It is quite easy to just use "using" on every IDisposable resource.

As for setting something to null just to let the GC know about it, a 
sign of premature optimization and a sign of not neither knowing how a 
GC works nor how to use a memory profiler.

--
Paulo


More information about the Digitalmars-d mailing list