4 ms·
I think it’s going to be table stakes for all new general-purpose languages. Rust demonstrated that memory safety and speed aren’t mutually exclusive. I’m conv
by kstrauser 4y ago
I think it’s going to be table stakes for all new general-purpose languages. Rust demonstrated that memory safety and speed aren’t mutually exclusive.
I’m convinced that future generations will look at us using C the same way that we look at old race cars withouts seat belts: it’s amazing that people ever managed to use it without immediately dying, but that fatal accidents were horribly common, and that we’d never go back.
- amelius 4y ago> Rust demonstrated that memory safety and speed aren’t mutually exclusive. memory safety, speed, ergonomics pick two.
- randall 4y agoThis is fair.
- LoganDark 4y agoI think Rust is fairly ergonomic, but that's because it happens to work really well with my mental model. I was able to pick it up and produce a multithreaded path tracer in about two weeks. What are some ergonomic issues, in your opinion?
- pdimitar 4y agoThat's generously assuming that C is ergonomic. Which it is not.
- saulrh 4y agoRust is a heck of a lot more ergonomic than many unsafe languages I've used, so I'm not sure I agree. In fact, it's probably the most ergonomic fast language I've ever used. Zig was pretty close but it had its own issues.
- WanderPanda 4y agoYou don‘t have to pick two, you can also just pick one Looking at you Bjarne
- brundolf 4y agoRust has made some headway in ergonomics too. Obviously the borrow-checker pulls it down quite a bit, but in other areas it makes up a lot of ground: tooling, language features like match expressions, traits (being able to hang new methods off of existing structs) and trait derivations, type inference, and then all the stuff third-party frameworks can do with macros (using something like Rocket isn't too far off from using Flask) There's still a tradeoff, but they push the boundaries quite a bit
- bqmjjx0kac 4y agoRust is least ergonomic when you're fighting with the borrow checker. It might be an interesting strategy to wrap shared objects with Gc<> or Rc<> by default to sidestep the fight. Once you've discovered the slowest parts of your codebase, you could refactor to replace Gc/Rc with zero-cost borrows or well-placed copies. I haven't tried this myself, but I'm surprised it isn't the standard operating procedure for (non-embedded) Rust programmers.
- amelius 4y agoWe should probably have functional programming by default for sanity, wrapping Rust inside it for the speed in inner loops.
- bqmjjx0kac 4y agoHmm, functional in what sense? Like functions should be pure by default, optionally annotated `impure` or something?
- amelius 4y agoIn the sense of allowing at least closures that are garbage collected (without them you can't idiomatically program in a modern functional style)
- btown 4y agoI think one of the issues is that Rc and Gc are not particularly ergonomic! Used at scale, they add noise/non-readability to any screen of code (Rc::clone, the various approaches for Gc in [0], for instance) that simply wouldn't be there in a dynamic language. Now, one might argue that this explicitness is good! But it's definitely an extra bunch of things to type when you're building something where you don't care about memory management. [0] https://manishearth.github.io/blog/2021/04/05/a-tour-of-safe-tracing-gc-designs-in-rust/ https://manishearth.github.io/blog/2021/04/05/a-tour-of-safe...
- zozbot234 4y ago
- avgcorrection 4y agoBeing able to pick two is still an improvement!
- Existenceblinks 4y agoRust binary size is not pretty either.
- jerf 4y agoIt isn't "going to be". It is, and it has been for a long time. Lots of people confusing "memory safety" with the high degree of thread safety offered by Rust. Memory safety is in everything modern except C and C++, and ASM. It's the present baseline, except those. Nobody is proposing new memory unsafe languages. Only a few straggler developers, possibly with the same confusion, are loudly insisting they somehow need memory unsafe languages. When you consider what "memory unsafety" means, the claims are transparently risible. Nobody needs the ability to access arrays out of bounds. Nobody needs access to unallocated memory. It's not a serious desire, it's just contrarianism or confusion about what it is.
- ithkuil 4y agoI recently stumbled upon Jai and Odin, two new languages which are not memory safe.
- ithkuil 4y agoAh and Zig is also not memory safe
- Jensson 4y agoAnd Rust, it isn't memory safe since you can go into unsafe anywhere, most languages doesn't allow unsafe code.
- jerf 4y agoMemory safety does not encompass code that is labelled and segregated as "unsafe", because by this definition all or nearly all languages are unsafe. There's always some way to execute some sort of assembly in the end.
- ithkuil 4y agoYou can write 100% safe code in rust. Just don't call into unsafe code or FFI into unsafe languages. Can you say the same with other languages like C/C++/zig/... ? Van you literally enforce with a compiler switch and/or linter that you're 100 using a safe subset of the language? You can view unsafe rust as a convenient way to go write in language that resembles rust what you'd otherwise write in C and call via a FFI
- pjmlp 4y agoC.A.R Hoare was already complaining about C in 1980. The world decided to ignore the likes of Modula-2, compiled BASIC and Pascal dialects, embrace UNIX and C, and so eventually we landed here.