D Compiler as a Library

Roman D. Boiko rb at d-coding.com
Sat Apr 21 07:28:15 PDT 2012


On Saturday, 21 April 2012 at 13:32:28 UTC, Marco Leise wrote:
> Am Thu, 19 Apr 2012 18:58:26 +0200
> schrieb "Roman D. Boiko" <rb at d-coding.com>:
>
>> I doubt specifying symbol it would be any better than 
>> location. For example, you would not be able to rename a local 
>> variable or any other symbol nested in a function.
>
> Yes you can! Try to compile this:
>
> 	void x() {
> 		int i = 1;
> 		void y() {
> 			int i = 2;
> 			{
> 				int i = 3;
> 			}
> 		}
> 	}
>
> Prints: Error: shadowing declaration x.y.i is deprecated
> Local variables have unique names and creating duplicate names 
> is deprecated since a while.

I guess x.y.i is just a convenience naming used by DMD, and it 
does not appear in specification.

Also, Artur Skawina provided a nice counter-example where it 
would not work.


More information about the Digitalmars-d mailing list