Bug 10581 – Undefined identifier "std.uni.isWhite" when passing string lambda to std.algorithm.filter
Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-07-09T08:42:00Z
Last change time
2013-07-09T10:10:22Z
Assigned to
nobody
Creator
monkeyworks12
Comments
Comment #0 by monkeyworks12 — 2013-07-09T08:42:35Z
import std.algorithm;
import std.uni;
void main()
{
//Compiles
auto x = [" "].filter!(a => a.canFind!(not!isWhite));
///.../std/functional.d(56): Error: undefined identifier isWhite
auto y = [" "].filter!"a.canFind!(not!isWhite)";
}
Comment #1 by issues.dlang — 2013-07-09T10:10:22Z
Sorry, but that's not a bug. It's one of the major reasons that the newer lambda syntax was introduced. The string lambda syntax only works with stuff that's imported by std.functional, and there's no reason for std.functional to import std.uni other than making string lambdas work with std.uni, and we obviously can't make that work with everything, because we can't have std.functional importing everything.
Also, while I don't particularly like it (as string lambdas are really nice for short stuff), Andrei and Walter seem to be in favor of phasing out string lambdas anyway. But you're really not saving much by using a string lambda here anyway, so in this particular case, I don't think that that's much of a loss.