braceless with statements

user1234 user1234 at 12.de
Sat Nov 13 09:07:55 UTC 2021


On Friday, 12 November 2021 at 23:43:51 UTC, kdevel wrote:
> On Friday, 12 November 2021 at 21:44:25 UTC, user1234 wrote:
>> void main()
>> {
>>     with (L) - R;
>> }
>> 
>> now remove the parens... oops the parser sees a binary minus ;)
>
> that would then translate into
>
>    void main()
>    {
>        with (L - R) { }
>    }
>
> for which the compiler complains about undefined identifier 
> `R`. I must admit I have difficulty to get your point. Under 
> the removed parantheses version you could (additionally) write 
> the original code as
>
>    void main()
>    {
>        with L;
>        - R;
>    }

you can craft code where both work


More information about the Digitalmars-d mailing list