Join Slack
Powered by
Might it be possible to create a spread operator f...
# announcements
d
Daniel
04/22/2019, 7:34 PM
Might it be possible to create a spread operator for my own class? Lets say I have a class
Operands : List<Operand>
and I want to spread it with
*operands
instead of
*operands.toTypedArray()
which I have to use now
r
Ruckus
04/22/2019, 7:54 PM
No, the spread operator cannot be overloaded. The documentation has an exhaustive list of overloadable operators:
https://kotlinlang.org/docs/reference/operator-overloading.html
Ruckus
04/22/2019, 7:56 PM
If you want to propose it, you could try in
#C0B9K7EP2
, though I'm pretty sure it has been shot down before (though I can't recall exactly why)
d
Daniel
04/22/2019, 8:08 PM
Thank you for your answer! Totally fair when you know when its not overloadable. 🙂
Open in Slack
Previous
Next