Can file name, module name, class name and variable name be the same?

Brian Schott via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 18 00:39:07 PST 2016


On Monday, 18 January 2016 at 05:20:42 UTC, WhatMeWorry wrote:
> I can workaround the problem but it seems like a kludge; I'm 
> curious about the subtleties of this problems.

You can't have a variable with the same name as a module because 
they're both symbols with the same name. It messes up the symbol 
resolution code. (Also, it confuses any programmer who reads your 
code)

Check the "renamed imports" section at 
http://dlang.org/spec/module.html. You should be able to say 
something like `import c = camera;`.





More information about the Digitalmars-d-learn mailing list