UFCS limit

Antonio antonio at abrevia.net
Thu Jun 16 23:59:06 UTC 2022


```d
auto doSomething(string text)
{
   return (string text2)
   {
     import std.stdio;
     writeln(text,",",text2);
   };
}

void main()
{
   doSomething("Hello")("X");
   "X".doSomething("Hello")();
}
```
Compiler error:

```
...
onlineapp.d(13):        expected 1 argument(s), not 2
```

I tried with some syntax change:

```d
void main()
{
   doSomething("Hello")("X");
   (doSomething("Hello"))("X"); // it works
   "X".(doSomething("Hello"))(); // fails!!!
}
```

```onlineapp.d(14): Error: identifier or `new` expected following 
`.`, not `(````

Is it there any way to apply UFCS on the returned method in the 
same expression?




More information about the Digitalmars-d-learn mailing list