First draft: added with-colon statement

qxi qxi.urt at gmail.com
Sat Jan 18 21:19:14 UTC 2025


On Thursday, 16 January 2025 at 06:53:23 UTC, Walter Bright wrote:
> This was requested in the newsgroups. Adds the syntax:
>
> ```
> {
>     with (E):
>        statement;
>        statement;
> }
> ```
>
> which is equivalent to:
>
> ```
> {
>     with (E)
>     {
>        statement;
>        statement;
>     }
> }
> ```
>
> and that's all there is to it.
>
> https://github.com/dlang/dmd/pull/20715

In current implementation if there is multiple 'with:' in same 
scope then last 'with:' take precedence and I think multiple 
'with:' in the same scope should have the equal precedence.

'''
enum E1{ A,B }

enum E2{ B,C }

{
   with (E1):
   B;  // E1.B

   with (E2):

   A;  // E1.A
   C;  // E2.C
   B;  // this should be error because 2 matched symbols 'E1.B' 
and 'E2.B'
}
'''



More information about the dip.development mailing list