November 28, 2005 the return value of "with" | ||||
---|---|---|---|---|
| ||||
Can the following statements be valid? Foo foo; foo.setData( with(new SomeObj(Arguments)) { // some init to SomeObj } // end of with ); // end of setData |
November 28, 2005 Re: the return value of "with" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shawn Liu | Shawn Liu wrote:
> Can the following statements be valid?
>
> Foo foo;
> foo.setData( with(new SomeObj(Arguments))
> {
> // some init to SomeObj
> } // end of with
> ); // end of setData
>
>
Actually I was thinking of asking Walter to make any with statements which are passed a null reference to be skipped, as this would simplify the many times we check for null before setting members:
a = getResource();
if ( a is null ) return;
with(a) { ... lotsa stuff here ... }
becomes
with( getResource() )
{
..stuff here..
}
but that may be 'semantic overloading' taken too far, hehe.
-DavidM
|
Copyright © 1999-2021 by the D Language Foundation