4 ms·
> Yeah, but many of the Rust features are present in the branch of Algol derived languages, namely Mesa, Modula-2, Modula-3, Oberon derivatives, Ada, Pascal dia
by pcwalton 11y ago
> Yeah, but many of the Rust features are present in the branch of Algol derived languages, namely Mesa, Modula-2, Modula-3, Oberon derivatives, Ada, Pascal dialects....
None of these have memory safety without GC (while supporting dynamic allocation and deallocation).
- pjmlp 11y agoYou are doing a great job with Rust, but I think you always jump to quickly to criticize Wirth languages and push for Rust. Mesa => RC with local GC for collecting cycles. Modula-2 => True, does manually memory management, but avoids all other C memory corruption errors. Modula-3 => Uses GC only for types allocated via NEW. Library contains generic RC pointers. Untraced pointers can only be used in unsafe code. Oberon derivates => Uses GC only for types allocated via NEW. Active Oberon added support for untraced pointers only in unsafe code. Ada => No GC. All memory allocation is controlled. Deallocation is only possible via regions or explicitly in unsafe code. There are generic RC libraries as well. Pascal dialects => No GC. Suffer from manual memory management, but none of the other typical exploits regarding out of bounds or pointer misuse. Yes, they may lack affine types, but had they succeed in the industry instead of C, the need of something like Rust would be greatly reduced. As such now we have to place our hopes in something like Rust, because the new generations never heard of those languages and think C was the very first systems programming language. However every time I look at Rust sample code I would like to see the same amount of _unsafe_ being used like in the those languages. Instead, many Rust users seem to sprinkle it everywhere.
- smosher_ 11y ago> new generations never heard of those languages and think C was the very first systems programming language. That's just it. Rust looks enough like C++ to catch on. This was not an accident though I can't say I'm jazzed about it. Rust brings a lot to the table with its type system too. I would rather be using Rust tomorrow than having had the benefits of say Pascal derivatives for the past 45 years. I'm not saying this just for effect: after the obvious ML influence, the parts of Rust I like most are the nuances. > Instead, many Rust users seem to sprinkle it everywhere. Is that true? You will necessarily see it in bindings, or to implement certain essential features that can't be implemented otherwise. Beyond that there is the motivation to use unsafe code for speed, hopefully this is mostly restricted to modules. Are you complaining that people are using when they could reasonably avoid it or that it is too often necessary?
- pjmlp 11y ago> Are you complaining that people are using when they could reasonably avoid it or that it is too often necessary? They are abusing it, specially as workarounds for constraints that cannot be expressed in the type system. While in the languages I mentioned, unsafe constructs are related any operation that might lead to memory corruption, some Rust devs are using it for anything they assume isn't logical safe. So you then get talks like the Session Types one at ICFP, that uses unsafe to control functions being called outside the protocol Traits that are being defined. Which lead to discussions like this one: https://github.com/rust-lang/rfcs/pull/1236#issuecomment-136875613 https://github.com/rust-lang/rfcs/pull/1236#issuecomment-136...
- kinghajj 11y agoSo your objection is to how certain users (notably not the core dev team) utilize "unsafe", now with the language itself. It seems like the easiest way to mitigate this is with better documentation; surely, those other languages' equivalents of "unsafe" could also have been abused similarly, no?
- pjmlp 11y agoNo, because on those languages unsafe is only related to memory integrity.
- smosher_ 11y ago> They are abusing it, specially as workarounds for constraints that cannot be expressed in the type system. That doesn't sound like abuse to me, as long as the exposed interface remains safe. > some Rust devs are using it for anything they assume isn't logical safe. That sounds like an objection to the scope of what Rust defines as safe. Unless you mean to imply there are reasonable, Rust-safe ways to rewrite the transgressions. In the former case I have to disagree. It would be nice if we could prove more. But you can't prove everything. I haven't seen the ICFP talk but I might watch it later if you can link to a video. I've skimmed that discussion before but you will need to point out your objections—IMO it is great that Rust devs are having that discussion.
- pcwalton 11y ago> You are doing a great job with Rust, but I think you always jump to quickly to criticize Wirth languages and push for Rust. I'm not criticizing those languages. I think they're valid points in the design space. I'm simply saying that they didn't do what Rust does: memory safety with no GC (and dynamic allocation/deallocation).
- pjmlp 11y agoRust's approach to built on what Cyclone and ATS have done is great work. My point is that we would be less in need of Rust, if those systems programming languages have had taken C's place. So given that they failed to gain mindshare, except for Ada in a niche domain, we now need new alternatives. Still be prepared for an uphill battle with C++17, as language is only part of the equation, as I learned from being in the Wirth languages side for a few years.