surrounded type modifier

Namespace rswhite4 at googlemail.com
Wed Sep 18 07:23:23 PDT 2013


On Wednesday, 18 September 2013 at 14:17:04 UTC, Maxim Fomin 
wrote:
> On Wednesday, 18 September 2013 at 13:23:10 UTC, Namespace 
> wrote:
>> Code:
>> ----
>> const { /// [1]
>> 	int a = 3;
>> }
>>
>> void main()
>> {
>> 	const { /// [2]
>> 		int b = 4;
>> 	}
>> }
>> ----
>>
>> Why is [1] allowed, but not [2]?
>
> Citing grammar:
>
> FunctionBody:
>     BlockStatement
>     BodyStatement
>     InStatement BodyStatement
>     OutStatement BodyStatement
>     InStatement OutStatement BodyStatement
>     OutStatement InStatement BodyStatement
>
> BlockStatement:
>     { }
>     { StatementList }
>
> As you can see there is no room for attributes. Why dmd does 
> not support attributes here is separate question - probably 
> because such construct would be confused with lambda, but this 
> is not a serious reason.

Should I open an enhancement report?


More information about the Digitalmars-d-learn mailing list