braceless with statements
Steven Schveighoffer
schveiguy at gmail.com
Sun Nov 14 21:18:29 UTC 2021
On 11/14/21 12:39 PM, Ogi wrote:
> On Sunday, 14 November 2021 at 16:51:01 UTC, kdevel wrote:
>> Wrong: replace /* lots of code here */ with int x:
>
> Hmm, it works indeed. Not sure if that’s intended, since the other way
> around is prohibited:
>
> ```D
> struct S { int x; }
> void main ()
> {
> S s;
> int x;
> with (s) {
> x = 42; //Error: with symbol `onlineapp.S.x` is shadowing local
> symbol `onlineapp.main.x`
> }
> }
> ```
>
Yes, it's intended.
I do get your point, but I don't think it's any more confusing than
normal `with`.
-Steve
More information about the Digitalmars-d
mailing list