Neat trick - 'with' and unnamed objects + 'with' proposals

BCS BCS at pathlink.com
Tue Apr 24 09:09:55 PDT 2007


Bill Baxter wrote:
> BCS wrote:
> 
>> Bill Baxter wrote:
> 
> 
>> how about take a trick from "if"
>>
>> with(auto name = new someGUIWidget(myParent))
>> {
>>    shown = true;
>>    focusable = false;
>>    some_global_function(name);
>> }
> 
> 
> Yeh, I was actually just thinking that myself, and was disappointed to 
> find out it doesn't work.  :-(
> 
> Looking at the spec it seems that's special to 'if'.   It could be 
> useful for switch(), with() and synchronized(), but it seems it hasn't 
> been added.
> 
> --bb

Ohhh. That would be nice in switch ... and while...



More information about the Digitalmars-d mailing list