Closed LouisCAD closed 10 months ago
This topic can be rephrased better, indeed.
The underlying point is to avoid arrays, because otherwise authors are forced to make a defensive copy (and that's not that great -- it's hard to reason about in the long run; this is exactly the reason Enum.values()
is deprecated for good). We should shift focus to that point rather than "do a defensive copy otherwise"
Of course, we meant to say, "If enum would return not a defensive copy, then… And defensive copies might be expensive."
https://github.com/Kotlin/api-guidelines/blob/461bd2b03d7b99bee2c2fe400a36fe5d50a359bf/docs/topics/jvm-api-guidelines-predictability.md?plain=1#L152-L170