Davide Giuseppe Farella
06/30/2020, 1:49 PMinfix fun A.function(b): X ,
then I have operator fun X.invoke(f: () -> Unit)
so I’m trying to call a function b { ... }
But I get B cannot get invoked as a function, I’ve tried to use plus
a function b +{ ... }
But I got something similar.
If it use infix infix operator fun X.invoke(f: () -> Unit) is fine ( a function b invoke { ... } ), but cannot get rid of that explicit invoke
If I do like (a function b) { ... } is also fine, but still ugly 🙂
Any solution?
Thanks 🙂Davide Giuseppe Farella
06/30/2020, 2:45 PMa func b run { ... } OK
a func b + { ... } NO
😕Shawn
06/30/2020, 2:55 PMDavide Giuseppe Farella
06/30/2020, 3:11 PM+ was just a try that could be nice, it’s not supposed to be a math stuff.
But why a func b plus { ... } is fine?Davide Giuseppe Farella
06/30/2020, 3:12 PMDavide Giuseppe Farella
06/30/2020, 3:19 PMB and handle like:
A.func(BPlus)
I might get out if it 🙂Davide Giuseppe Farella
06/30/2020, 3:45 PM