4 ms·
>but I’d love the best of both worlds if it were possible I am just going to quote what pcwalton said the other day that perhaps answer your question. >> I’d
by ksec 2y ago
>but I’d love the best of both worlds if it were possible
I am just going to quote what pcwalton said the other day that perhaps answer your question.
>> I’d be much more excited about that promise [memory safety in Rust] if the compiler provided that safety, rather than asking the programmer to do an extraordinary amount of extra work to conform to syntactically enforced safety rules. Put the complexity in the compiler, dudes.
> That exists; it's called garbage collection.
>If you don't want the performance characteristics of garbage collection, something has to give. Either you sacrifice memory safety or you accept a more restrictive paradigm than GC'd languages give you. For some reason, programming language enthusiasts think that if you think really hard, every issue has some solution out there without any drawbacks at all just waiting to be found. But in fact, creating a system that has zero runtime overhead and unlimited aliasing with a mutable heap is as impossible as finding two even numbers whose sum is odd.
[1] https://news.ycombinator.com/item?id=43726315 https://news.ycombinator.com/item?id=43726315
- skybrian 2y agoYes, but I’m not hoping for that. I’m hoping for something like a scripting language with simpler lifetime annotations. Is Rust going to be the last popular language to be invented that explores that space? I hope not.
- hyperbrainer 2y agoI was quite impressed with Austral[0], which used Linear Types and avoids the whole Rust-like implementation in favour of a more easily understandable system, albeit slightly more verbose. [0]https://borretti.me/article/introducing-austral https://borretti.me/article/introducing-austral
- renox 2y agoAustra's concept are interesting but the introduction doesn't show how to handle correctly errors in this language..
- hyperbrainer 2y agoAustral's specification is one of the most beautiful and well-written pieces of documentation I have ever found. It's section on error handling in Austral[0] cover everything from rationale and alternatives to concrete examples of how exceptions should be handled in conjunction with linear types. https://austral-lang.org/spec/spec.html#rationale-errors https://austral-lang.org/spec/spec.html#rationale-errors
- Philpax 2y agoYou may be interested in https://dada-lang.org/ https://dada-lang.org/, which is not ready for public consumption, but is a language by one of Rust's designers that aims to be higher-level while still keeping much of the goodness from Rust.
- skybrian 2y agoThe first and last blog post was in 2021. Looks like it’s still active on Github, though?
- Ygg2 2y ago> Is Rust going to be the last popular language to be invented that explores that space? I hope not. Seeing how most people hate the lifetime annotations, yes. For the foreseeable future. People want unlimited freedom. Unlimited freedom rhymes with unlimited footguns.
- xmorse 2y agoThere is Mojo and Vale (which was created by a now Mojo core contributor)
- the__alchemist 2y agoMaybe this is a bad place to ask, but: Those experienced in manual-memory langs: What in particular do you find cumbersome about the borrow system? I've hit some annoyances like when splitting up struct fields into params where more than one is mutable, but that's the only friction point that comes to mind. I ask because I am obvious blind to other cases - that's what I'm curious about! I generally find the &s to be a net help even without mem safety ... They make it easier to reason about structure, and when things mutate.
- rc00 2y ago> What in particular do you find cumbersome about the borrow system? The refusal to accept code that the developer knows is correct, simply because it does not fit how the borrow checker wants to see it implemented. That kind of heavy-handed and opinionated supervision is overhead to productivity. (In recent times, others have taken to saying that Rust is less "fun.") When the purpose of writing code is to solve a problem and not engage in some pedantic or academic exercise, there are much better tools for the job. There are also times when memory safety is not a paramount concern. That makes the overhead of Rust not only unnecessary but also unwelcome.
- the__alchemist 2y agoThank you for the answer! Do you have an example? I'm having a fish-doesn't-know-water problem.
- int_19h 2y agoBasically anything that involves objects mutually referencing each other.
- the__alchemist 2y agoOh, that does sound tough in rust! I'm not even sure how to approach it; good to know it's a useful pattern in other langs.
- spullara 2y agoWith Java ZGC the performance aspect has been fixed (<1ms pause times and real world throughput improvement). Memory usage though will always be strictly worse with no obvious way to improve it without sacrificing the performance gained.
- estebank 2y agoIMO the best chance Java has to close the gap on memory utilisation is Project Valhalla[1] which brings value types to the JVM, but the specifics will matter. If it requires backwards incompatible opt-in ceremony, the adoption in the Java ecosystem is going to be an uphill battle, so the wins will remain theoretical and be unrealised. If it is transparent, then it might reduce the memory pressure of Java applications overnight. Last I heard was that the project was ongoing, but production readiness remained far in the future. I hope they pull it off. 1: https://openjdk.org/projects/valhalla/ https://openjdk.org/projects/valhalla/
- spullara 2y agoAgree, been waiting for it for almost a decade.
- no_wizard 2y agoI have zero issue with needing runtime GC or equivalent like ARC. My issue is with ergonomics and performance. In my experience with a range of languages, the most performant way of writing the code is not the way you would idiomatically write it. They make good performance more complicated than it should be. This holds true to me for my work with Java, Python, C# and JavaScript. What I suppose I’m looking for is a better compromise between having some form of managed runtime vs non managed And yes, I’ve also tried Go, and it’s DX is its own type of pain for me. I should try it again now that it has generics
- neonsunset 2y agoUsing spans, structs, object and array pools is considered fairly idiomatic C# if you care about performance (and many methods now default to just spans even outside that). What kind of idiomatic or unidiomatic C# do you have in mind? I’d say if you are okay with GC side effects, achieving good performance targets is way easier than if you care about P99/999.