Improving Compiler Error Messages

Jonathan M Davis jmdavisProg at gmail.com
Sun May 16 04:24:22 PDT 2010


Walter bright wrote:

> I agree with you and a couple of examples would  be most helpful.

Well, unfortunately, I've generally been in enough of a hurry when coding 
that I haven't saved examples of it as I've been coding. I'll have to watch 
out for it more and get small examples from that. However, one example which 
I have would be


import std.algorithm;

void main(string[] args)
{
    auto result = args.find('h');
}


Instead of complaining that I'm using the wrong type with find(), it results 
in the error

/path/to/dmd2/linux/bin/../../src/phobos/std/algorithm.d(1763): Error: no 
property 'empty' for type 'char'


findAmong() and findAmongSorted() do not have the same problem, so I guess 
that they do things differently enough to avoid it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list