refactoring issues

Ivan Kazmenko via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 17 08:11:01 PDT 2015


Hi,

I was just refactoring a project to compile under 2.067.

The fixes themselves were trivial: just adding "import 
std.traits;" to some files.  Apparently its pieces were publicly 
imported by another module in 2.066.  So, it's the right fix 
anyway.

Understanding what happened, however, took more time than fixing. 
  Surely, the compiler couldn't just say "hey, I know, you forgot 
to import std.traits!", and threw some distant consequences at me 
instead.  Essentially, there were two complications:

1. In a complex template constraint, if some identifier 
disappears out of scope, the whole constraint silently fails, and 
the whole template instantiation fails with a rather generic 
error message.

2. When the compiler could not find a suitable overload of a 
function, if there are template and non-template overloads, it 
lists only non-template overloads.

My question therefore is: can the process be improved somehow to 
address the above issues?  For the former problem, is there a 
tool which jumps out and tells you use Phobos without importing 
things properly, or suggests a Phobos import by the name of the 
stuff.  For the latter one, I wonder if this is the intended 
behavior.

Ivan Kazmenko.


More information about the Digitalmars-d-learn mailing list