was there ever any discussion about having borrow ...
# language-proposals
g
was there ever any discussion about having borrow semantics like rust's in kotlin?
r
I don't think that could work, as it has to run on the JVM and JS as well as native.
j
Should be fine since it's compiler enforcement. The JVM and JS GC will grab objects when they go out of scope and native will just free
There's no reification of ownership so you can have it in any language, VM, or runtime.
r
I just meant for interop, since that's a big focus of Kotlin.
Also, I bet it would be a huge turn off to new users.
j
No different than nullability interop. It's just a property Java doesn't track and you could opt into it with annotations
g
Yeah from what I can tell its largely a front-end feature, I'm not sure what kind of runtime (if any) rust needs to enforce it.
I'm also not familiar enough with rust to know how effective this feature is
but it seems to me like a really nice way to mitigate the headache that is thread safety
actually, when i was considering grad school i was thinking about a kind of
Pure
annotation that could be compiler-enforced, this seems like a really elegant superset of something like that.
j
There's no runtime. The feature is the main selling point of Rust. Honestly there's little reason to use the language otherwise. It enables all of the great features therein.