Does anyone use 'with' statement?

serg kovrov sergk at mailinator.com
Sun Dec 9 05:41:25 PST 2007


Well, I perfectly understand the intent. My first thoughts regarding 
'with' was it could be used for isolating/grouping of complex objects 
initialization. for example:

with (window = new Window())
{
     Create();
     Move(12, 34);
     Attach(children);
     Show(true);
     Etc();
}

But as everyone agreed so far, 'with' requires discipline. And my 
experience taught me that when it comes to others code, discipline is 
not the thing you can count on.

Speaking of other 'disciplined' software development aspects such as 
manual memory management, manual references management, goto's, etc., it 
could be mitigated by unit and system testing. But still, testing do not 
guaranteed program correctness. And in case of readability I don't see 
means to enforce (or even motivate) 'correctness' just yet.


-- serg.



More information about the Digitalmars-d mailing list