"with" should be deprecated with extreme prejudice

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 18 14:56:19 PDT 2009


Bill Baxter wrote:
> On Mon, May 18, 2009 at 1:36 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> That's not an "equiv of". It's "completely missing the point of". Each
>> "using" costs one new scope and one level of indentation which makes it
>> non-scalable. Indentation is *expensive*. I think the C# folks missed the
>> class when try/catch/finally showed with extensive examples just how
>> expensive extra indentation is.
> 
> Oh.  Is that the only thing that bothers you about it?
> That doesn't bother me much since it's basically for things you only
> want to hold on to for a short span.  You should either do your
> business in a few lines of code and get out of there, or if you can't
> then make it a function.   Anyway, if the indentation bugs you, you
> can always set emacs up not to indent on "using" blocks.

It's huge! In TDPL, as soon as I show the expansion of two scope(exit)
statements, code became unreadable. No wonder today's software has so
crappy error handling and state leaks: languages seem to make it as hard
as possible to write correct transactional code.

Andrei



More information about the Digitalmars-d mailing list