dynamic classes and duck typing

Walter Bright newshound1 at digitalmars.com
Tue Dec 1 19:11:17 PST 2009


dsimcha wrote:
> == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
>> D has three: RAII, scope guard, and try-catch-finally. As far as I'm
>> concerned, the only reason t-c-f isn't taken out to the woodshed and
>> shot is to make it easy to translate code from other languages to D.
> 
> I've literally never written a finally block in my life in D because scope
> statements and RAII are just that good.  Does anyone, other than a few beginners
> who were unaware of scope guards, use finally?  I'm half-tempted to say we should
> just axe it.  It's an error prone legacy feature that's completely useless for any
> purpose except writing Java or C# code in D.  Since we're looking to lighten the
> spec, ditching finally would do so, and it would encourage converts from Java and
> C# to learn a better way of doing clean-up code.

I'm sympathetic to that point of view, but it is pure drudgery to unwind 
try-catch-finally into proper scope statements.



More information about the Digitalmars-d mailing list