5 ms·
I was pretty disappointed in the lack of progress, but a few things come to mind: 1. IMO Rust has the closest thing in "imperative" languages to haskell's type
by hardwaresofton 8y ago
I was pretty disappointed in the lack of progress, but a few things come to mind:
1. IMO Rust has the closest thing in "imperative" languages to haskell's type system in a recently released "mainstream" language.
2. Rust brings an entirely new value (memory safety), and accordingly an entirely new hurdle called the borrow checker. This feature is so advanced that languages like Haskell are catching up (it's not a competition really) by introducing things like Linear Types[0]. That's really impressive.
3. Rust is targeting system programmers -- they move the slowest (as they should) in the ecosystem and are the most risk averse (as they should be).
4. Compare Rust to relatively recent systems-level languages (I won't name any), it's doing great.
5. Staying at the same place in the rankings is actually moving forward -- it may not seem like it, but it's hard to stay both effective, liked, and relevant in the world of programming languages (see: Dart).
I don't think rust is the kind of language to just shoot up the rankings -- it contains both higher level techniques that aren't quite mainstream yet and is targeted at a smaller community (though they're kind of going after web people with the wasm stuff).
I think rust is the kind of language that shows up to be consistently near the top of the rankings in 10 years (and I've said it numerous times but I think Go will displace Java and Rust will displace C/C++ where possible).
Yes, I will concede to a slight bias in favor of rust :).
[0]: https://gitlab.haskell.org/ghc/ghc/wikis/linear-types https://gitlab.haskell.org/ghc/ghc/wikis/linear-types
- sk0g 8y agoNow I'm curious! What are other systems-level languages? I know Go was touted as one at the start, but that's definitely not where it's established a niche! Julia? Nim? That's about all that comes to mind. I wish I could read the Haskell documentation, but the code examples are straight up black magic to me. I really need to dig into some proper functional programming at some point!
- pjmlp 8y agoD, Free Pascal/Delphi, .NET Native, Ada, ATS, Zig, Jai, Oberon, C++20
- hardwaresofton 8y agoI was mostly thinking of Dlang or Swift, but even those are actually not quite the same due to the lack of runtime. I think Go doesn't qualify as a "systems language" due to the inclusion of the runtime -- do people call Java/JVM languages "systems languages"? The term "systems language" is almost certainly not precise enough. What I mean to convey was a language that you could write performance critical low level code in. In my mind though, Rust satisfies both that definition and the vaguer "backend service" (i.e. the thing spinning behind some interface doing the hard work in your architecture) -- it works very well from very low level all the way up to application programming. If we're taking the second definition (vague backend-service-y) then Rust has lots more good competition -- if you can afford a runtime then the right language can give you some pretty good safety for less than the cost of learning Rust's borrow checker. BTW I hear you on the haskell docs, how to start with Haskell is one of the hardest things. I personally took this path: - http://learnyouahaskell.com http://learnyouahaskell.com (a fun read, introduction to basics, good prose) - Writing some euler solutions (quickly stopping, they become just a mathematics fest after a while) - http://book.realworldhaskell.org/ http://book.realworldhaskell.org/ (excellent examples for real-world code) - http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://adit.io/posts/2013-04-17-functors,_applicatives,_and_... (when you feel like you really want to understand the big M) - Writing the backend for a project in haskell - Watching lots and lots of talks and attempting to read papers to just headbutt certain concepts over and over till I could somewhat begin to understand them. I've found the secret is just to let the stuff go over your head at least 2-3 times until you start finding it useful. But I want to stress that you don't have to write 5th order polymorphic dependently-typed whatever to get lots of value from haskell, here is some low hanging fruit: - Haskell has the type system you thought/wish Java/C# had (i.e. `type AorB = A | B`, `newtype PositiveNumber = N { _posNum :: Int } -- guaranteed through constructor to be >= 0`). The ease with which you can have types express intent is mentally revolutionary. - Behavior and object structure are separate, like Go's structs + interfaces or Rust's structs + Traits, and constraints (dependencies from one typeclass to another) are really easy to use -- ex. `class Thing a => BigThing a where { ... }` expresses the dependency that for a to be a `BigThing` it needs to first fulfill the requirements of being a `Thing` -- this is how you can force the existence of certain functionality on with polymorphism. Once you get used to this everything else (well, subtyping at the very least) will look primitive. - Concurrent programming is amazing, both due to STM and the very good threading model (lightweight routines multiplexed to system threads) - I will say that I think there's lots of low hanging fruit out there though -- Haskell has the type system you thought Java/C# would have. They really have "class" systems rather than type systems.
- hnra 8y ago> I wish I could read the Haskell documentation, but the code examples are straight up black magic to me. I really need to dig into some proper functional programming at some point! Haskell definitely has a high early threshold that you need to get over. After that it's pretty much just fun and smooth sailing until you try to do something bigger, at which point there's another threshold. The learning experience is the most fun I have had programming.
- jonsen 8y agoI really need to dig into some proper functional programming at some point! As absolutely suitable for self study I would recommend: https://www.amazon.com/Elements-ML-Programming-ML97-2nd/dp/0137903871/ https://www.amazon.com/Elements-ML-Programming-ML97-2nd/dp/0...
- weavie 8y agoHaskell is easier to learn than it seems : https://patrickmn.com/software/the-haskell-pyramid/ https://patrickmn.com/software/the-haskell-pyramid/ Just get the basics down and write some stuff. For a lot of things, you don't need to know how they work underneath in order to use them. It is helpful to implement functors, applicatives and monads for some of the basic data structures to get a feel for things, but then beyond that, just use what has been provided. Don't try to write your own monad transformers, just use the mtl library. Lenses are really complicated to understand, but really simple to use. The servant web library uses some high end type level stuff in order to work, but it is really easy to use. The compiler has your back. If something just doesn't work and doesn't make sense, just move on and find a different way. After a while you will understand more and can return to it. Don't try to understand the academic papers that have been written with Haskell. There is a really tradition of making the Haskell code as incomprehensible as possible. It will just get you down.
- mark_l_watson 8y ago+1 for your Haskell comments That is what I do: I use a subset of the language, don’t dive too deeply into the theoretical stuff, for anything imperative I find an example to follow, and just enjoy writing pure code in a comfortable interactive environment (VSCode or Emacs). It is possible to just use Haskell ‘lightly’ and enjoy it. The only problem for me is that it can take me a while to understand other people’s Haskell code when I read it.
- weavie 8y agoYep. I agree reading other peoples Haskell can be a challenge. There is a real culture of making your code as terse as possible, which I think makes it easier to read once you know what you are doing, but makes it harder for beginners. Luckily Haskells type system means that you can understand a lot about what is going on just by looking at the type definitions. Most code includes these. Although rather frustratingly, however, a lot of documentation doesn't include the type definitions. It is good to see languages such as Idris make it mandatory to include type definitions for all functions.
- 8y ago
- pjmlp 8y agoGo needs to grow up for it even to be considered by most Java shops.
- hardwaresofton 8y agoCould you expand on this? Java certainly isn't perfect today and it certainly wasn't perfect when it gained the mindshare it has now. I think it's pretty impressive that Golang has achieved anywhere-near-JVM speed with easier concurrency primitives and ease-of-use in the time it has. What standard are we holding Go to that Java would have fit at the time? If you meant Ecosystem-wise there are very few ecosystems that can compare to Java, since it's been around so long and has been the workhorse of (I think) the majority people being paid to write code for so long. If this was the way we picked languages, no new languages would ever emerge. People are being productive in Go, and they're using it to write lots and lots of software. It's a good tool and is already production worthy, at the very least based on the fact that it's already running in production in many places and hasn't spectacularly failed anyone yet. somewhat related rant Also, I think Go changed it's official logo (from the gopher) in an attempt to fit this kind of language, and I think it's stupid. Who cares if their logo is of a worm -- if it's a good piece of software, then the right people (who value good software and craftsmanship over some appearance/facade of professionalism) will use it. People pay us to write good performant software, most of the time they wouldn't care if you wrote it in Brainfuck as long as it worked and worked well (of course, there's also the fact that someone has to maintain it, but let's pretend that doesn't exist). end rant
- pjmlp 8y agoGo today is a Java 1.4 without AWT/SWT/Swing. It needs to catch up a lot with Java 12.
- hardwaresofton 8y agoWell functions are first class so I think we can bump it up to Java 1.8? Also I'm not sure missing a GUI toolkit is an indictment of a growing language these -- systems programming very often does not involve a GUI.
- tayo42 8y agorust could be targeting more then "systems" but its hard to write multithreaded networking services. thought maybe that changes soon? it could also compete with go and python for command line tools but I think the mental overhead of the syntax makes it hard. i would rather write rust then go or python though. Rust also feel like a very work in progress language, especially with useful features only in nightly often.
- hardwaresofton 8y agoHey I'm not a member of the rust team so take my comment with a huge chunk of salt, but this is changing very soon. The rust community seems to be slowly but steadily working through a bunch of bigger use cases (all in the open as well, so you can see exactly what they're doing and why). For networking use cases, see projects like tokio[0] and hyper[1] to see how the community is moving (here's an awesome talk on it[2]). To me, it looks like the rust community is actually trying really hard to build things modularly and slowly from the start, taking tons of time to "measure twice cut once". All that said, building networked systems in Rust is definitely extremely usable right now (and in many cases without nightly, I don't turn it on for any of my projects) -- maybe you won't find a gopher-server crate (rust's packaging mechanism) but for regular HTTP/HTTP2 you're going to find a lot of production-ready software (rocket[3], actix-web[4], tower-web[5]). I'd love to be pointed to some recent post where someone spelled out their issues writing some basic HTTP/HTTPS REST-ish backend servers (which I think is what the majority of people are writing/maintaining in their day jobs). Side note (I'd love for someone to correct me), but generally when people want "performant" multithreaded network services, I take that to mean they want the combination of all system cores utilized and IO treated asynchronously -- in my mind this is basically all it takes, everything else is application/solution-space level optimization (parse your JSON a little quicker, maybe use a better data structure, do more things concurrently, etc). Rust has both of these things (system threads, libraries with async support) -- for example async/await syntax is landing soon, and from what I know the state of the art has progressed in this manner: callbacks->deferred/promises/futures->async/await -- rust is already 2/3 and async/await support is landing soon. And on top of all this -- rust is going to make parallelism & concurrency safer -- this is huge because while it might have been easy to `#include <pthread>` in C/C++, it sure isn't/wasn't easy to write correct concurrent/parallel code without the support of a runtime. [0]: https://tokio.rs/ https://tokio.rs/ [1]: https://hyper.rs/ https://hyper.rs/ [2]: https://www.youtube.com/watch?v=4QZ0-vIIFug https://www.youtube.com/watch?v=4QZ0-vIIFug [3]: https://rocket.rs/ https://rocket.rs/ [4]: https://actix.rs/ https://actix.rs/ [5]: https://github.com/carllerche/tower-web https://github.com/carllerche/tower-web
- anfilt 8y agoNot sure about you saying it will replace C. I could understand C++ though.
- hardwaresofton 8y agoI'm definitely on super thin ice with C -- C++ is the surer bet. To be fair, there are also people who have been working tirelessly to improve C++ so they're not getting left behind either. I do think eventually it could replace C though -- because rust with `unsafe` blocks still has the possibility of being safer than C. This could be a boon to security critical software, as long as the performance margin isn't too hard. Shops that have found ways to write safe C will likely never move (they don't need to), but new ones might pick rust where they might have picked C otherwise. BTW, the embedded support in rust is really impressive for such a young language: https://github.com/rust-embedded/awesome-embedded-rust https://github.com/rust-embedded/awesome-embedded-rust
- ncmncm 8y agoThere is no chance of Rust "replacing" C++. There is no chance of it even cannibalizing many seats from C++. The net benefit is just not there. But Rust is so overwhelmingly better than C, Go, Java, and C# for things people use those for, it may have a bright future replacing them, once its libraries and tooling mature enough. It will be competing with C++ on that, but there's room for both.