On 07/09/2016 8:26 PM, Andre Pany wrote:
On Wednesday, 7 September 2016 at 08:08:34 UTC, rikki cattermole wrote:
On 07/09/2016 8:06 PM, Andre Pany wrote:
Should I open an enhancement request?
No.
It works outside of the function (part of lookup rules).
I simplified my example too much. Yes in the example above I can move
the alias
outside the main function. Here is a more complex example.
As I use the input parameter args in the alias, I cannot move the alias
outside
the main function.
import std.algorithm;
bool fulfillsKeyPredicate(string s, string t) {return true;}
void main(string[] args)
{
alias keyPredicateFilter = filter!(e =>
e.fulfillsKeyPredicate(args[0]));
string[] arr;
keyPredicateFilter(arr);
arr.keyPredicateFilter;
}
Is there a workaround? Or is still a valid scenario to change the lookup
rules?
People have tried, this is the behavior as designed.
The workaround is simple, don't use UFCS.
I won't repeat the explanation or reasoning here, plenty of posts on it ;)