UFCS for arguments other than first?
Heisenberg via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 12 02:55:03 PST 2016
On Saturday, 12 November 2016 at 06:42:24 UTC, Temtaime wrote:
> You are wrong. We can use n1 for the second parameter.
>
> int someNumber(int a, int b)
> {
> return a + b;
> }
>
> int main()
> {
> int n1 = 5;
> return (n1.someNumber = n1); // 10
> }
In this specific case, yes - however:
>int getResult(int a, int b, int c)
>{
> return(a * 2 - b * 3 + c * 4);
>}
>int main()
>{
> int n1 = 3, n2 = 5, n3 = 7;
> // If one needs to chain n3,
> // but requires it to be entered
> // as the third argument?
> return(n3.getResult(n1, n2)); // `n3` is the `a`
> return(n3.getResult = tuple(n1, n2)[]); // still `a`
>}
Being able to specify the position would help maintain 'the
chain' intact.
More information about the Digitalmars-d
mailing list