Re:The Unsound Playground: Java and Scala's Type Systems are...
by marvy on Sunday November 27, 2016 @11:27PM
(#13053400)
Read-only is too strict. Can't reverse the array, or sort it.
[ Parent
| on HN ]
Re:The Unsound Playground: Java and Scala's Type Systems are...
by int_19h on Monday November 28, 2016 @03:31AM
(#13054157)
Sure you can - you just need to copy it.
And I didn't mean to imply that array references should always be read-only. What I meant is that there should be a way to say "the referenced array cannot be mutated through this reference", like const* in C. 90% of the time, when you pass or return arrays, this is exactly what you want.