On Sunday, 9 June 2013 at 10:11:25 UTC, 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?

Regards,
Khurshid.

You're right but the with statment in Pascal/Delphi is deprecated. While it was usefull in a simple branch, it was error-prone. In "D" the scope() statement can be used to overcome the old Pascal pattern: with whatIcreate try finally free.

quote from Delphi XE4 release (technical pdf):
"4. OTHER LANGUAGE CHANGES
Besides string type changes and objects memory management, there are other current or expected changes in the new Delphi ARM compiler that you can easily start to adopt:  Sooner or later, the with statement is going to be deprecated and removed from the Delphi language. You can easily start removing it now from your code, and most Delphi developer will agree this is a good idea anyway, given some of the hidden pitfalls of this
keyword.
"

Reply via email to