From: Sean O'Dell Date: 2002-06-06T13:22:14+09:00 Subject: Re: Pascal-like 'with' statement? Chris Morris wrote: >>That's something I would LOVE to see added. >> > > FWIW, many Delphi programmers discourage the use of with -- although that > may be in part to limitations of previous versions of the debugger (with > Delphi 5, you can mouse over a variable and get a pop-up watch, but not on > variables that resolve to the obj of the with block). Another reason is that > it can make the code less readable: > > - if the block under the with is too long > - if multiple items are used in the with block, it can be confusing which > one is being referenced > > // this is legal > with AObj, BObj do > begin > MemberA := 'x'; > MemberB := 'c'; > end; > > .. does MemberB belong to BObj, does MemberA belong to AObj? There's no way > to know just by looking at this block. I've never heard of its use discouraged, but then Pascal is hardly my religion. :-) When you have a lot of operations to perform on a single object in sequence, it's quite handy. I didn't know the syntax you show is legal. Seems foolish that they allowed such a thing. I would NOT recommend that *ahem* feature find its way into Ruby. Sean