[Issue 15614] New: more helpful error messages when bang omiitted
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jan 26 17:02:34 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15614
Issue ID: 15614
Summary: more helpful error messages when bang omiitted
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: laeeth at laeeth.com
import std.stdio;
import std.string;
import std.process;
import std.algorithm;
import std.array:array;
import std.typecons:Tuple;
import std.file:exists;
enum whitelists=[ "/etc/mail/spamassassin/sent_whitelist.txt",
"/etc/mail/spamassassin/vcard_whitelist.txt"
];
enum postgreyWhitelistPath="/etc/postfix/postgrey_whitelist_clients.local";
int main(string[] args)
{
bool all=false;
string result;
foreach(file;whitelists)
{
result~=(cast(string)std.file.read(file))
.splitLines
.map(a=>a.extractDomain)
.array
.sort
.uniq
.filter(a=>(a.length>0))
.join("\n");
}
std.file.write(postgreyWhitelistPath,result);
return 0;
}
string extractDomain(string entry)
{
return entry;
}
simple.d(22): Error: template std.algorithm.iteration.map cannot deduce
function from argument types !()(string[], void), candidates are:
/usr/include/dlang/dmd/std/algorithm/iteration.d(431):
std.algorithm.iteration.map(fun...) if (fun.length >= 1)
Perhaps we could check if it would compile if a ! were added to the parameters
and if so say "did you mean ...?"
Yes, one quickly gets used to it, but it's one more needless friction for
people learning the language.
--
More information about the Digitalmars-d-bugs
mailing list