Can file name, module name, class name and variable name be the same?
WhatMeWorry via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 17 21:20:42 PST 2016
file 1: camera.d
-----------------------
module camera;
class Camera
{
public:
// Camera Attributes
vec3 position = vec3(0.0f, 0.0f, 0.0f);
. . .
};
-----------------------
file 2: main.d
-----------------------
module main;
import camera;
Camera camera; // Compile error (1)
-----------------------
(1) variable main.camera conflicts with import main.camera at
main.d(30)
Renaming "Camera camera;" to "Camera cam;" gets rid of the error
but now I've got tons of new undefined references with camera.
Have I broken some rule by having file name, module name, class
name and object name
being all cameras? Is there some technique I can use to get
Camera camera; to compile?
I can workaround the problem but it seems like a kludge; I'm
curious about the subtleties of this problems.
More information about the Digitalmars-d-learn
mailing list