News for hackers. Stuff that matters.
Re:a[low:high:max] in Golang – A Rare Slice Trick by MrBuddyCasino on Sunday March 19, 2023 @03:43AM (#35216901)
> Since it's the JVM model

Java model. Kotlin collections are immutable by default (not sure about Scala, but I suspect they behave the same).

Re:a[low:high:max] in Golang – A Rare Slice Trick by morelisp on Sunday March 19, 2023 @05:41AM (#35217442)
No, I'm pretty sure it's the JVM model. Kotlin collections are "immutable" in that they have no mutating accessors, which is not the same thing as a memory region defined to be immutable by the specification which can be relied on to e.g. trivialize certain compiler optimizations.

You can also look at what kinds of things are allowed in class constant pools; you will not find any collections.

https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.ht...

Re:a[low:high:max] in Golang – A Rare Slice Trick by MrBuddyCasino on Sunday March 19, 2023 @07:46AM (#35218057)
If you specifically mean RO memory pages, then yes, thats not the same thing. The language and the runtime will enforce collection immutability though, throwing an exception if you attempt to mutate. Poking at the underlying byte code will defeat this, of course.