On Sun, 09 Jun 2013 14:09:31 -0400, deadalnix <deadal...@gmail.com> wrote:

On Sunday, 9 June 2013 at 10:22:22 UTC, Jonathan M Davis wrote:
On Sunday, June 09, 2013 12:11:23 khurshid wrote:
D language have like Pascal/Delphi  "with statement",  which very
useful for writing readable code.
 http://dlang.org/statement.html#WithStatement
 Maybe I'm wrong, but, I never saw  where using this statement in
phobos  source codes, what problem using this statement?

I'm not aware of any problems with it, but there's also rarely any reason to use it. In most cases, it doesn't really add anything to the code, and I'd
argue that it would make code harder to read, because it hides where the
variables are coming from. I don't think that we'd really lose anything if we didn't have it, but it's there if you want to use it, and it's not going away.

- Jonathan M Davis

switch(foobar) with(FoobarEnum) {
     // ...
}

That is golden !

This is gold plated.

Assuming typeof(foobar) == FoobarEnum, any place FoobarEnum is expected, you should not have to specify FoobarEnum.

The above should not be necessary.

-Steve

Reply via email to