On 10/08/2014 9:34 p.m., "Marc Schütz" <[email protected]>" wrote:
On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
'[email protected]
<mailto:[email protected]>' forum
There's already an implementation proposed.
No other statement construct works like that, there doesn't seem to be
much point to adding such a special case.
It's possible to add this syntax for any statement, then `with` wouldn't
be a special case :-P But this wouldn't be a good idea IMO. With `if`
and loops, it would hurt readability.
On the other hand, `with` might be useful. It would be used similar to
`using namespace` in C++, and it would (almost) always appear at the
start of a scope.
I've had a need before for it in the past.
But I think a better idea might be:
void func(MyClass clasz) with(clasz) {
}
If you're using with as
funcdecl {
with(value):
with(value2):
body
}
I'd be surprised.
But its mostly for /faking/ methods outside of class.