10 ms·
Systems Languages: An Experience Report
- Apocryphon 8y agoWould Swift qualify as one? Also wondering if the author considered D.
- dvfjsdhgfv 8y agoI'm disappointed about the lack of D, too, since the author gave Nim a try. And it's definitely more mature than, say, Pony (which is an interesting language for other reasons). Also, you can get excellent performance in D, really close to what you will get with C, and that's very often the crucial factor in systems programming.
- giancarlostoro 8y agoI definitely consider D one since it's meant to be a continuation to C / C++ without caring about 'backwards compatibility' which is a good thing imho.
- pjmlp 8y ago> Would Swift qualify as one? For Apple it does. "Swift is a successor to both the C and Objective-C languages." https://developer.apple.com/swift/ https://developer.apple.com/swift/
- bogomipz 8y agoThe author states: >'Similarly, a Java programmer must understand the runtime behaviour of the JVM, but until OpenJDK, the implementation language was irrelevant." Can someone say why did the implementation language become relevant with the arrival of OpenJDK? My java app should run on any JVM no? After all that was the raison d'être of Java no? Or is the author referring to something else?
- sargun 8y agoHow do you debug the Java runtime, or when you Java program does something other than desired?
- vvanders 8y agoI think everyone agrees that "fighting" the borrow checker is annoying, however at the risk of sounding like a Rust apologist I find that a couple interesting things have happened over ~2 years with the language: 1. The borrow checker usually kicks in when I want to take shortcuts that would bite me in the future. 90% of issues I hit with it can be solved with copy/clone. 2. When I take the time to satisfy the borrow checker I find my architecture is better. Usually I'm tripping the borrow checker because I don't have a clear single-owner or separation of concerns. Also, if you're looking for an "easy" to program languages there's tons of them out there and it definitely doesn't make sense in my mind to use Rust where C#/Erlang/Java/etc fit the domain space better.
- andolanra 8y agoThese points are absolutely consistent with my experience. I'd also dispute the author's claim that, "If the language has the problem that people are fighting with the language in order to become productive with it, perhaps something is wrong with the language, and not the programmers?" And I would argue that this is an ill-placed criticism: it doesn't mean something is "wrong" with either the language or the programmers: instead, it just means that it's a technology that has a learning curve. I also had early awkward periods of low productivity when I first started learning how to touch-type: that doesn't mean that something is wrong with keyboards!
- kenhwang 8y agoI found out that 90% of the time, I'm more at fault than the borrow checker because I'm writing code that would be unsafe should concurrency/parallelism be introduced. But a lot of people don't naturally write or even know how to write concurrency safe code, especially when there's no intention for the code being parallelized.
- sargun 8y agoI'm not arguing the borrow checker is wrong, I'm just saying, rather than being the Star Ship: Enterprise's computer, and asking me to put up shields, I want the language to put up the shields for me. Yes, they might result in a power drain, but 99% of the time, I don't want to get shot, at the expense of power. Just treat things as immutable, and copy them around, or automagically allow for wrapping / unwrapping a (Ref)Cell/(A)rc
- exitcode00 8y agoNo mention of Ada at all. Very sad and disappointing - Rust basically has a carbon copy of all of its features. It deserves a fair shake..
- okl 8y agoAgreed. Whether rust has copied its features - I don't know, but I have re-implemented many of Ada's features for several projects in other languages (mostly C), so it seems there is an amount of basic features like storage pools/memory pools which are usually required for systems programming tasks. Good for Rust then, I guess.
- sargun 8y agoI tried Ada a while ago. It seems like a neat language. Maybe I’ll do a blog post on it too, but it turned into a rabbit hole. I think one of the problems was where can I go to ask Ada questions?
- pjmlp 8y agoYou could start here, https://www.reddit.com/r/ada/ https://www.reddit.com/r/ada/ https://stackoverflow.com/questions/tagged/ada https://stackoverflow.com/questions/tagged/ada http://www.ada-europe.org/auj/home http://www.ada-europe.org/auj/home
- bogomipz 8y ago>"Rust basically has a carbon copy of all of its features" Might you have any links or resources where I could read about the similarities between the two?
- pjmlp 8y agoYou could learn about Ada 2012 here. http://www.ada2012.org/ http://www.ada2012.org/
- rapsey 8y ago> If the language has the problem that people are fighting with the language in order to become productive with it, perhaps something is wrong with the language, and not the programmers? Or maybe writing correct (i.e. safe) code is more difficult then most programmers realize and they lack the humility to admit it.
- garmaine 8y agoThat’s true, but not what that quote is about.
- rapsey 8y agoThere are two sides to any coin. The complexity of the language is a consequence of the complexity of the problem it is trying to solve and the constraints it is operating under. The borrow checker is not just some crazy torture device that exists for no reason. Criticizing the difficulty of the borrow checker without considering why it exists in the first place is completely misguided.
- garmaine 8y agoFalse dichotomy -- there are always more than two sides to any issue. People find themselves fighting with the borrow checker because their mental model of what they're writing is not what Rust is interpreting. This is probably indicative of two things: (1) their mental model is incorrect in some ways, and (2) Rust's semantics don't map that well onto how we think about systems programming problems. If satisfying the borrow checker makes you think "whoops, that was dumb" then you're in category 1. If it makes you think "aargh, how do I express this in a way Rust will accept?!?" then you're in category 2. With an ideal language category 2 wouldn't exist.
- AnimalMuppet 8y agoOf course, it's very easy to think you're in category 2 when you're really in category 1 but don't see how you're wrong...
- dom96 8y agoWe discussed this article in the Nim forum recently: https://forum.nim-lang.org/t/3922 https://forum.nim-lang.org/t/3922.
- coldtea 8y ago>If the language has the problem that people are fighting with the language in order to become productive with it, perhaps something is wrong with the language, and not the programmers? If they stop fighting after they learn, then no, it's not a problem with the language. It's the very definition of learning. Now, the language might be harder to learn than others, and that might be a problem in itself. But not just because people have to struggle at first "in order to become productive with it". That's true for any language that brings anything new to the table. >The argument of pass by reference, or borrowing is that it’s more performant than cloning by default. In general, computers are getting faster, but systems are getting more complex. Rust was not created to piggyback on "computers getting faster". It was created to be as fast as possible.
- smolder 8y agoGood points. Performance not being a primary concern is a meme that really has grown beyond its place. Performance is absolutely a primary concern in very hot code, at execution scales where it means big differences in aggregate hardware/infrastructure cost, energy usage, and so on. Or in space, where transistors necessarily need to be "low tech" huge radiation resistant ones. There will never be a lack of applications for highly optimized software, no matter how small the niche gets. Computing power may be cheap but it is NOT free, nor infinite, nor universally portable.
- steveklabnik 8y agoOne area we're seeing Rust get a lot of usage for isn't performance directly, but low memory usage. You can do a lot more with less.
- sargun 8y agoEh, in the last press release from Mozilla, they say otherwise: > Confidence when doing systems-level programming. For old hands, Rust’s guarantees mean you can spend less of your time and attention on avoiding pitfalls, which makes it possible to reach for more ambitious goals. For newer systems programmers, it means a shorter path to being able to start writing production code. > This second point is worth emphasizing. In traditional systems programming, there’s just an intense amount of discipline you need to learn in order to write production code. Because the discipline takes so long to master, and the stakes of slipping up are crashes and security vulnerabilities, most people will only trust seasoned veterans of systems programming to ship production C++ code. But with Rust, you don’t have to master this discipline to start shipping production code; you know the language has your back. As far as I can read, it states the purpose of the language is correctness, and developer productivity?
- samuell 8y ago> "The thing that nobody told me is that OCaml’s runtime cannot do two things at once. It has a Python-style GIL." That's the reason I kick-started a crowd sourcing effort to collect a table of such basic facts among compiled "systems" languages: https://docs.google.com/spreadsheets/d/1BAiJR026ih1U8HoRw__nzbCSFnnHicWrjxpW5l6-O3w/edit?usp=drivesdk https://docs.google.com/spreadsheets/d/1BAiJR026ih1U8HoRw__n... (There's still a lot of gaps in there which you are welcome to help fill out)
- kbenson 8y ago> We have the Rust Evangelism Strikeforce nudging us towards rewriting everything in Rust. I really wish this would stop being repeated. At this point it's a meme that was rarely, if ever, actually accurate. People just repeat it because they've seen comments urging the use of Rust, and this leap is easy to make and justifies a bit more pushback. It's not about "rewriting", it's about new projects. People are starting new projects that do the same thing as old ones all the time. What you actually see is a lot of Rust advocates trying to influence those people to use Rust instead of C or C++, so instead of yet another library implementation in C or C++, we have one in Rust. If it's better than the prior implementation, it might be used. This part has nothing to do with language, and better implementations come along all the time and are adopted to some degree. For example, Nginx. I remember the days when your choice for an open source webserver that could scale was basically Apache (there were a few others, but generally weren't used for serious sites). Misrepresenting this cycle is just spreading FUD that activates a constituency to circle wagons. It's not helping anyone (as we're seeing from both sides of the political spectrum, which have gone all-in on this tactic lately).
- pvg 8y agoMisrepresenting this cycle is just using FUD to activate a constituency to circle wagons. It's not helping anyone (as we're seeing from both sides of the political spectrum, which have gone all-in on this tactic lately). It's a offhand remark in a post that's not about any of this. You're going out of your way to interpret this small thing in the worst, flame-inviting way.
- kbenson 8y ago> You're going out of your way to interpret this small thing in the worst, flame-inviting way. Which supposes a different way to interpret this. Feel free to provide a different interpretation or this very short and straightforward sentence, and I'll definitely consider it. Also, to be clear, I'm not positing that the author intends to cause the stated effect, I'm stating that the meme does this by it's nature, and the meme is also self-propagating by its nature and this same effect. The wording I used (that you quote) can be interpreted assigning intent to the author, which was not my goal, so I've changed them slightly. (I would note the change with a note on the original, but I think these comments are sufficient to document it).
- skymuse 8y agoI really hope he doesn't fall into the trap I did when starting out with rust. I came into it with the perspective of an application programmer and I quickly became salty when my knowledge didn't translate smoothly into rust code. "Fighting the borrow checker", for me, was simply a clash of philosophies. My way of thinking versus the rust way of thinking. The central issue, for me, is that with rust you MUST understand the memory model completely in order to be productive. You cannot wing this, you cannot assume anything. I was not used to this being an application programmer and this lead to the root of all my suffering. Once I wrote down all the borrowing rules and deeply thought about it, I finally became productive in the language. I see the author shows symptoms of not understanding the memory model. His code proves it. Instead of being angry, he should try to view rust with an open mind and ask "why did they design it this way?". Be curious, create experiments, probe the rust semantics, master the borrow checker. There are rewards to be had for those willing to push through the pain of integrating new knowledge.
- sargun 8y agoPretell, how does my code not show an understanding of the memory model? I understand how the memory model works, I just want the language to _do the easy thing_ (copy) in most scenarios, and make embedding (Cells, RCs) / unwrapping more straightforward.
- mindB 8y agoI had a brief dalliance with pony last year, though I wasn't coming at it from a systems perspective. At the time, it was the "lowest level" programming language I had used. Maybe the author's perspective is just that much different from mine (he's used to things like C++ and Rust), but "simple" is just about the last word I'd use to describe pony. Don't get me wrong: Pony is a pleasure to work with, and it is no more complicated than necessary for the problem it's trying to solve, but adding the capabilities layer to the normal type system makes for a language that has a lot going on. I'd expect that the amount of fighting newcomers do with the capabilities system is similar to how people fight Rust's borrow checker. Maybe the author just didn't have enough actors that wanted to share state/communicate where it wasn't an issue for him. In any case, I highly recommend anyone thinking about picking up a new programming language to give pony a look, especially if problems you're trying to solve are amenable to high levels of concurrency and need to run fast. The pony capability system basically eliminates data race bugs (within pony), and also guarantees against runtime crashes. It's got a bit of a learning curve, and the package ecosystem around it isn't great yet, but it's doing unique things to solve problems many languages aren't attempting to address.
- deleted 8y ago[deleted]
- dorfsmay 8y agoRust passing by value/reference: NOTE: The following is my understanding, from discussions on IRC and reading articles. If I'm wrong, please, please, please correct me (and provide good backup to what you are saying), because this is fundamental, and for me is one of the biggest misunderstanding in Rust. When deciding to use passing by value vs passing by reference, the only deciding factor should be ownership. If it makes sense to give ownership, pass by value, if it makes sense to retain ownership, pass by reference. This will NOT affect performance, the actual implementation of copying memory around vs reassigning which part of the program owned that piece of memory is an implementation detail and the rust compiler will try to do the right thing. I stopped fighting the borrow checker once I stopped treating Rust references as if there were C pointers, using them to minimize memory copy instead of concerning myself with ownership. I find the book does a bad job of explaining this, I'd be happy to give a try to write a chapter about it, but need to first confirm that my understanding is correct.