about "with statement"

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 9 03:22:05 PDT 2013


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


More information about the Digitalmars-d mailing list