UFCS not working with alias
Andre Pany via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 7 01:26:50 PDT 2016
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?
Kind regards
André
More information about the Digitalmars-d-learn
mailing list