"Philippe Sigaud" <philippe.sig...@gmail.com> wrote in message news:mailman.32.1280323222.13841.digitalmars-d-le...@puremagic.com... > > void foo(string str) > { > str = > std.algorithm.map!q{ > inPattern(a, [digits, letters])? a : '_'; > } > (str); > } > > But then I guess inPattern must be visible from std.algorithm. > > So my current conclusion it that it's more a limitation of anonymous > closures than a limitation in map. >
*sigh*, If D allowed something like this: mixin string map() { return "code here"; } map(); As an alternative to or intead of this: string map() { return "code here"; } mixin(map()); As I've suggested before (it only got accepted for template mixins, not string mixins), then map's string-style predicates could be made to be evaluated in the proper context without screwing up map's standard interface by requiring it to be called with "mixin(...)".