2 ms·
I thought Titus's tip spells it out pretty well. In Java we know Doodad is some.long.package.hierarchy.Doodad and not some.Doodad or some.other.Doodad or an.ent
by tialaramex 5y ago
I thought Titus's tip spells it out pretty well. In Java we know Doodad is some.long.package.hierarchy.Doodad and not some.Doodad or some.other.Doodad or an.entirely.different.Doodad because we explicitly wrote that down. The tooling helps you with spelling but the language provides exactly what is needed here.
If you introduce ambiguity, the code won't compile.
In C++ too bad, you wrote Doodad and thought you were getting ::some::new::package::hierarchy::Doodad however that doesn't actually exist, you were thinking of ::some::long::package::hierarchy::Doodad and your compiler didn't complain because it silently concludes you wanted ::some::Doodad which does exist (maybe it was added years ago and is rarely used, or maybe it was added in the new version you got last week) even though you never actually wanted anything from ::some itself. C++ loves ambiguity, because now it's your fault this happened, you were less than perfect and as such unworthy of the power and grace of C++