surrounded type modifier

bearophile bearophileHUGS at lycos.com
Wed Sep 18 06:42:36 PDT 2013


Namespace:

> Code:
> ----
> const { /// [1]
> 	int a = 3;
> }
>
> void main()
> {
> 	const { /// [2]
> 		int b = 4;
> 	}
> }
> ----
>
> Why is [1] allowed, but not [2]?

Think about what this does:

void main() {
     {
         int b = 4;
     }
}


It creates a new scope inside the function. How do you tell apart 
the syntax to create a new scope from having a "group tagging" as 
in the global case?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list