8 ms·
A few years ago I was a C evangelist. C++ was and more so now is a fine language with a lot of features I want. But Rust has that simplicity in a systems langua
by webkike 9y ago
A few years ago I was a C evangelist. C++ was and more so now is a fine language with a lot of features I want. But Rust has that simplicity in a systems language that I crave that lets me do my own thing. That elegence.
It's my favourite language by far. Keep it up!
- nickpsecurity 9y agoSimplicity? Modula-3 was simple, fast, and safe. PreScheme was less type-checked but powerful and simple. You can learn how to use them in a day coming from an imperative or functional language. Rust looks like it gives users extra power/safety with quite a bit of a learning curve (most say weeks to months) due to extra complexity. Definitely not simple, though. https://en.m.wikipedia.org/wiki/Modula-3 https://en.m.wikipedia.org/wiki/Modula-3 https://en.m.wikipedia.org/wiki/PreScheme https://en.m.wikipedia.org/wiki/PreScheme
- webkike 9y agoIt's definitely simpler than most other systems languages in what it gives you access too. Go, D, C++, C# are all far more complicated than Rust is. I would argue Modula-3 is not as simple because it contains a garbage collector - thus making the connection between written and compiled code less simple. Don't know much about pre scheme
- jabits 9y agoHave only checked Rust out a bit, but you mention C#. Does Rust have functionality similar to, and as easy to use, as Linq?
- zlynx 9y agoLinq, ick. It's a performance nightmare. No one knows what it is actually doing in the background so firstly, everyone writes horrible O-cubed performance with it, and then it is a series of random poking around to try fixing it.
- xorxornop 9y agoDepends if you're using it with ORMs or not. It's equally as useful with data in memory. Definitely slower for some things though (yes, it's always slower in one sense... But its also easier to make parallel, so it can even out in the end) Still, I now prefer doing such things in Rust.
- moosingin3space 9y agoIn Rust, you'd generally use functions that return iterators or Tokio's streams for Linq-style tasks. Check out the "Complex Queries" example on http://diesel.rs http://diesel.rs for an example of what a Linq-like library looks like in Rust.
- xorxornop 9y agoYes, it does. Also a C# programmer. I really like Rust. About as easy to use to transform, filter, group etc, but considerably faster.
- placeybordeaux 9y agoHow are you defining complexity in a programming language?
- webkike 9y agoI suppose it's the difference between the computational model presented by the language verses the computational model presented by the computer. A combination of how many components require some runtime environment to exist and how many disparate language features there are. Not an intuitive definition of simple for sure, but this is in the context of a system's programming language. In terms of just plain simple, I'd say scheme or just lambda calculus even takes the cake.
- placeybordeaux 9y agoSo the fact that that is a scheduler and a garbage collector in go means that by your definition even the simplest go program has a large complexity cost?
- webkike 9y agoNot necessarily large, but it factors into the mean complexity cost.
- comex 9y agoGo, at least, is far simpler as a language than Rust, and the implementation (compiler) is less complex overall, especially if you count LLVM on Rust's side. I suppose that Go programs exhibit more complex behavior at runtime due to the GC and green threads and stuff, but it's a huge stretch to call Go more complicated overall. On the other hand, I'd argue that Rust makes up for the complexity with performance, power (ability to express more complex programs in less code), and safety (not just memory safety, which Go also mostly guarantees, but the ability to leverage the type checker to verify code correctness in general). C++, on the other hand, is more complex (due to all the legacy drift), yet equal in performance, less safe, and less powerful in most respects (there are some things C++ can do that Rust can't, but more things for which the opposite applies).
- webkike 9y agoConsider how interfaces work and how you would have to implement them. Rust may have a more complicated type system and I suppose enums are more complicated in Rust, but the things I value as simple are more simple in Rust than Go.
- comex 9y agoWhat about interfaces? The basic idea of fat pointers with vtables works the same as Rust's trait objects. If you mean the ability to dynamically cast from one interface type to another, which Rust doesn't support - that does require a global list of implemented interfaces per type, but without generics that's not too hard to implement. (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)
- webkike 9y agoWhen ever you would need to box a trait object in Rust Go automatically performs a heap allocation that is garbaged collected at some point. A bit more is explained here https://research.swtch.com/interfaces https://research.swtch.com/interfaces Basically there are some property of Go interfaces that make them far more dynamic than traits and implementations in Rust.
- pjmlp 9y agoThat is what the Assembly view of the compiler is for. Also your complaint can be applied to C as well. Given how optimizing compilers work, and the amount of UB being exploited, the language stoping being simple long time ago.
- cwzwarich 9y agoHow is Rust simpler? In terms of cognitive complexity on the part of the user, Modula-3 is much simpler; it is easier for a programmer to learn to write new Modula-3 code and correctly read Modula-3 code than it is for Rust code. In terms of implementation complexity, Modula-3 is also much simpler, despite the existence of a GC. A Modula-3 spec would be a great deal smaller than an equivalently detailed Rust spec. Many people have independently implemented Modula-3, whereas an independent implementation of Rust is effectively impossible, due to all of the unspecified implementation-defined behaviors. If you told me I had 1 year to implement either language from scratch, I would much rather choose Modula-3.
- steveklabnik 9y agoThere are two alternative implementations of Rust in the works; one is _almost_ able to compile rustc at this point.
- cwzwarich 9y agoWhat are these implementations? The one I immediately found by searching (https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc) is accompanied by an explicit nongoal to correctly implement the language. It also doesn't seem particularly independent from rustc, given the similarities in implementation strategy and the fact that some parts look like rustc code converted to C++.
- steveklabnik 9y agoMrustc is one; my understanding is that it isn't yet, because its purpose in life is to make bootstrapping/ddc stuff easier. Once that works, I thought it intended to add the stuff that's missing. There's another that's not public.
- kibwen 9y ago> ddc stuff Note: this refers to "Diverse Double Compilation", which is a mitigation tactic against Reflections-on-Trusting-Trust attacks.
- nickpsecurity 9y agoModula-3, like many Wirth-inspired languages, can be described in a few pages with developers understanding those pages. You can be writing useful code in a day, using most of its features in a week, and probably master it in months to a year. The GC doesn't make it any less simple as that's one component that lets you ignore the complexity of memory management. The component itself can also be simple. Rust being simpler than other programming languages you cite actually means those languages are enormously complex. That is, given how much more complex Rust was to Wirth-style languages, Smalltalk, Scheme, and so on. It has extra stuff. Hence, the extra complexity. The compiler is also harder to write to make all that work.
- pjmlp 9y agoGiven the work being done in .NET Native and the planned features for C# 7.2, the language is starting to look like the spiritual descendent from Modula-3.
- kibwen 9y agoThe Modula-3 Evangelism Strike Force! We meet again! :)
- nickpsecurity 9y agoLol. While we're at it, I guess that makes Adacore and pals pushing Ada the Imperial Army, Ada Division given DOD background.
- Keyframe 9y agoAnd I was just about to preach Ada... ffs, man. We're not EVIL just because Death Star's OS is in Ada.
- nickpsecurity 9y agoRemember that little hole in the Death Star that blew the whole thing up? It was the C FFI. ;)
- nickpsecurity 9y agoOh yeah, I forgot to ask "Have you or the others considered rewriting your compiler in Modula-3? I hear you get safety, acceptable speed, and 5x iteration speed of Rust."
- lacampbell 9y agoI look forward to your fascinating re-implementation of unix tools from the 70s - only with less functionality.
- nickpsecurity 9y agoThat's what would happen lol.
- fizixer 9y agoLooking at Modula-3 wikipedia page, no thanks. (If it's case-sensitive, I don't want to switch to uppercase everytime I use the language keywords. If it's not case-sensitive, don't even get me started.) I had enough of that for a lifetime through FORTRAN, COBOL, SQL, BASIC, ASSEMBLY, etc. PreScheme sounds like an interesting idea.
- nickpsecurity 9y agoDo you have anything to say about it's feature set instead of just syntactic preference? As in, it's tradeoff in balancing complexity by what set of features?
- fizixer 9y agoLooking at it very briefly, its feature set is probably small enough to keep the language simple yet useful. To be clear, I'm not a Rust guy, or even C++, Go, D. On top of that, I'm a 2PL advocate (two programming languages). I think a combination of a readable high-level language like Python or Scheme, and a fast systems language like C, can carry out feats that no single programming language can as far as I know. (I don't consider keeping two or three programming language in your head while doing productive work a big deal, especially when learning multiple language is considered a beneficial thing).
- nickpsecurity 9y agoI'm with you on the 2PL right tool for the job idea. It's what I did. :)
- int_19h 9y agoIf I remember correctly, the only reason why Modula-3 is memory-safe is because it requires a GC. That right there is a no-go for a "C++ killer" system language.
- nickpsecurity 9y agoMost C++ apps can be written in a GC'd language. It has UNSAFE/SYSTEM for when you want to take chances managing your own memory. A language like Ada or Rust would be better at unsafe stuff.
- int_19h 9y agoYes, a lot of C++ code out there can be rewritten with GC. But for a language to replace C++, it has to cover the full spectrum, and that includes GC-less operation for low-level components. Providing primitives to manually allocate memory on unmanaged heap is not sufficient - the language must allow running without GC at all.
- nickpsecurity 9y agoIt does. It just isn't safe. The extra primitives for safer handling of pointers are main advantage of C++, D, Rust, etc. A worthwhile re-incarnagion of Modula-3 should have something similar.
- int_19h 9y agoSo the standard library doesn't rely on GC semantics anywhere? As I recall, that's the main problem with D: the standard library basically requires GC. Your code might not require it, but the library is always there. On top of that, it's just too easy to accidentally involve GC by using reference types.
- nickpsecurity 9y agoActually, I dont know. Good question. I tried to quickly get the info but all I found was about I/O. It's done UNSAFE to use platform-specific ways of reducing overhead. Probably no GC semantics there. Anyone curious who can get some Modula-3 source for stdlib might just look to see if UNSAFE is at the top of the routines. Also, if that turns off the GC, Id reason that just putting it in front of a stdlib function that was GC'd might make it work without it unless they screwed up memory management in the code itself.
- arwhatever 9y agoRust is a simple, intuitive language that just gets out of my way and lets me focus on solving the problem at hand.
- Kali909 9y agoI've only dabbled briefly in it and read various articles about the new features, but that hasn't been my very limited experience. The syntax and namespace constructs etc all look quite arcane to me, and then there's the borrow checker. Not sure I'd call it simple and intuitive (at least yet, for me).
- jmcomets 9y agoHaving written quite a bit of Rust, I agree with you that Rust is far from simple and not always as intuitive as say...Python or Ruby for example. However, I do appreciate the syntax which IMO is in that sweet spot between conciseness and expressiveness. Finally, the borrow checker is quite the experience. Whenever I banged my head trying to get some snippet to pass BCK, there was always an OH moment where I realized something was terribly wrong with my design. PS: Yes, there's still a few weird BCK false-positives. Hopefully we'll soon have non-lexical lifetimes[1] that should fix most issues. [1]: https://github.com/rust-lang/rust-roadmap/issues/16 https://github.com/rust-lang/rust-roadmap/issues/16
- arwhatever 9y agoI shouldn't joke like that - learning Rust was a 4-6 month long low point my my lifelong professional self-esteem. I think I'm coming out of it now, and am only continuing to use it Because Stockholm Syndrome. "No technology can ever be too arcane or complicated for the black t-shirt crowd." - Linus Torvalds