<SAM conversion for objects?> When I have a functi...
# forum
r
SAM conversion for objects? When I have a functional interface like fun interface Transformer { fun invoke(a: A) : B } … I can write… val intToString = Transformer { i -> i.toString() } I assumed the same syntax would also work for objects, so I tried… object IntToString : Transformer { i -> i.toString() } … but this isn’t allowed. Is there a reason why this wasn’t considered? When it was felt that the lambda body could be confusing in the case of objects, it would be natural to use a syntax like: fun object...