9 ms·
My biggest gripe with Rust is that is doesn't spark joy. I intellectually agree with a lot of its goals but every time I write some Rust I just find it dreary.
by kris-s 6y ago
My biggest gripe with Rust is that is doesn't spark joy. I intellectually agree with a lot of its goals but every time I write some Rust I just find it dreary. Maybe it's the ugly syntax, maybe it's the "code feel" of interacting with a grumpy compiler.
That said I know a lot of folks really dig it and think it's a breath of fresh air; more power to em'.
- raphlinus 6y agoAdding my voice to the "it sparks joy" crowd. I think it depends a lot on who I am and what I'm trying to do; I'm really motivated by performance, and when I'm writing in Rust I feel I can do that and also maintain higher level structure.
- dijit 6y agoThat's a shame, I find Rust (and, ruby) spark incredible amounts joy to code in. But I find that Go does not spark joy for me. ('.Dial'?!, first character case denotes public/private D:). I guess that it is very subjective.
- leaveyou 6y ago'.Dial' ?? What else would you expect instead of Dial ? If you get demoralized from an imperfect function name you are in the wrong domain of activity.
- dijit 6y ago.connect() or connection.new() like everything else. Python: https://wiki.python.org/moin/TcpCommunication#CA-b22bc303d6d0b4c7af1a18623aacd1d0900b6ff3_12 https://wiki.python.org/moin/TcpCommunication#CA-b22bc303d6d... Ruby: https://ruby-doc.org/stdlib-2.5.1/libdoc/socket/rdoc/TCPSocket.html https://ruby-doc.org/stdlib-2.5.1/libdoc/socket/rdoc/TCPSock... Rust: https://doc.rust-lang.org/std/net/struct.TcpStream.html https://doc.rust-lang.org/std/net/struct.TcpStream.html Julia: https://docs.julialang.org/en/v1/manual/networking-and-streams/#A-simple-TCP-example-1 https://docs.julialang.org/en/v1/manual/networking-and-strea... C++: https://github.com/KMakowsky/Socket.cpp/blob/master/Socket.cpp#L73 https://github.com/KMakowsky/Socket.cpp/blob/master/Socket.c... Win32 C: https://docs.microsoft.com/en-us/windows/win32/api/Winsock2/nf-winsock2-connect https://docs.microsoft.com/en-us/windows/win32/api/Winsock2/... Linux C: http://man7.org/linux/man-pages/man2/connect.2.html http://man7.org/linux/man-pages/man2/connect.2.html Swift: https://github.com/apple/swift-nio/blob/master/Sources/NIOEchoClient/main.swift#L96 https://github.com/apple/swift-nio/blob/master/Sources/NIOEc... Java: https://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#connect(java.net.SocketAddress) https://docs.oracle.com/javase/7/docs/api/java/net/Socket.ht... Javascript: https://gist.github.com/tedmiston/5935757#file-nodejs-tcp-example-js-L37 https://gist.github.com/tedmiston/5935757#file-nodejs-tcp-ex... Anyway, it's not about being demoralised, it just doesn't "spark joy". :)
- dullgiulio 6y agoGo follows the Plan9 system call name instead of the UNIX one. Dial is much more powerful than the UNIX dance of "getaddrinfo"+struct sockaddr init+connect(2). It might not seem much (and higher level languages usually abstract away the craziness that UNIX sockets are in C), but that's what the OS still gives you in 2020...
- dijit 6y agoPlan9's "Dial" is definitely a product of it's time, literally meaning to "Dial" a phone. More information here: relevant man entry: https://www.unix.com/man-page/plan9/2/dial/ https://www.unix.com/man-page/plan9/2/dial/ It specifically mentions making a call. The example even dials "kremvax". Usenet over AX.25 from the 80s. Pretty sure that is _actual_ dialling. But, I'm curious as to why Go's "Dial" is more powerful than a standard connection in any other language.
- p_l 6y agoPlan9's dial is derived from OSI approach of separating service and protocol (aka implementation), with name service as first-party component (BSD Sockets have it stapled over and it hurts). The example with calling kremvax over datakit specifically goes to show-off that all that specifies datakit usage is the "dk" string - nothing else. Similarly with XTI (and other OSI-oriented network APIs), what you are telling OS is "I want to have a stream oriented connection with graceful close, to service Y on host X", and you don't have to care at all whether it will be IPv4, IPv6, TUBA, CLNS over Ethernet, or direct serial modem exchange using HDLC. Go doesn't have all of that flexibility because it works from userspace, but it reuses the "service, not implementation detail" approach and lets you concentrate on human-readable domain names and service names instead of providing a maze of "hardcoded IP" issues.
- wahern 6y agoPlan 9's dial() interface is implemented in a user land library. In terms of the interfaces provided by the kernel, connecting a socket is anything but simple in Plan 9. See https://9p.io/sources/plan9/sys/src/libc/9sys/dial.c https://9p.io/sources/plan9/sys/src/libc/9sys/dial.c The reason no standard interface has replaced getaddrinfo + socket + connect is probably because it's just barely simple enough for common usage in C, and C was never the language you turned to when you wanted to write something short and sweet--that's why Unix environments have always hosted a myriad of other languages. If initializing a network connection were as complex as in Plan 9, doubtless Unix would have provided a more succinct libc interface for the common case The BSD Sockets API is also close to the simplest possible interface for supporting all the various address and socket option combinations that are possible. (The kernel provides mechanism, not policy.) So even if POSIX, Linux, or whatever included a better standard interface for initializing a connection, it would have to be in addition to the BSD Sockets API (or equivalent).
- self_awareness 6y agoWell... it is maybe subjective, but I have the same problem. Or even worse, I'm not very convinced by Go because it uses the first letter to denote public/private access. I know this is a weak argument, but... :P
- xrisk 6y agoI think what excites me most as a Rust newbie (~2 weeks) is the ability to write low-level and performant code and at the same time be ensured a fair amount of safety by the compiler. Something that Python/C++/Go cannot offer me. Also a fairly good development experience (compared to C++)
- twic 6y agoI'm okay with this. To me, Rust is a tool for writing a small number of pieces of very serious infrastructure: kernels, drivers, firmware, high-scale daemons, etc. These feel like works that should be executed in a mood of sober seriousness, rather than joy. Rust is a double bass, not a saxophone.
- dpbriggs 6y agoDefinitely sparks joy for me. Tooling is fantastic and once you're experienced enough it feels very well put together.
- aldanor 6y agoThe opposite here. Rust is the only language for me that sparks joy (I write numerical Python/C++ at work, well familiar with half a dozen other languages). Like, I find it extremely pleasing to write any kind of prototype in Rust and make things work. I guess once you have borrow checker embedded in your head and your newly written code compiles without errors most of the time, it becomes more pleasing, but that's not even the main point. There's something about it that's "just right" for me, not anything in particular but a multitude of various things.
- vmchale 6y agoDo you enjoy J for numerical programming?
- voppe 6y agoI understand the feeling, but from my experience it fades away pretty quickly once you get the feeling of the language. These days I'm working again with Rust to add a new feature to a project after not touching it for months, and that feeling of "oh dear god this is awful" that I felt when I was starting out with the language was back again. However, once everything clicked in, with the compiler telling me exactly what was wrong with the code, and the project compiling which meant that I could be damn sure that the code I wrote would work with little to no risk of breaking in unexpected ways... that sure did spark joy. Just my experience.
- masukomi 6y agoThat seems a lot like taking up smoking to me. I took a puff once. "Oh dear god this is awful" was pretty much my reaction. For some reason people experience this, then power through the "awful" until they've ingested so much they can't easily walk away from it. I've never understood this. Why continue taking "awful" puffs? Why not just use/ingest something else that doesn't feel awful? And yes, I get that languages are extremely subjective and some folks find it joyful not awful. Good for them. I'm glad they found happy. For everyone else though...
- worble 6y ago>maybe it's the "code feel" of interacting with a grumpy compiler. It's crazy, because this is that part I love the most. Both Rust and Elm just blow my mind every time the compilers not only throw up something I never would've noticed, but even tell me how to fix it! It's crazy to think how far we've come, and it still makes me giddy with excitement every time I see it.
- vmchale 6y agoIt's nice for lower-level programming but I miss functional programming myself.
- csharptwdec19 6y agoFighting with a compiler is a different feeling to be sure. I'm primarily a C# dev, which normally has a pretty happy compiler. But I've started playing with Websharper (Translates C#/F# code to JS.) One nice thing about the library is that once you understand the basics of composition, your JS -will- work as long as the compiler doesn't barf on what you did. But, it has the drawback of seeing more errors from the compiler itself. While at first it was frustrating, I realized that the time I spent dealing with the compiler errors was still less time than I would have spent troubleshooting my own handwritten JS.
- empath75 6y agoI absolutely love the rust syntax, it makes me happy. Getting through compiler errors is a grind, but it does get better as you stop making the same mistakes.
- carlmr 6y agoComing from safety critical C/C++ I'm really happy about the grumpy compiler. It catches basically every mistake where you would normally in C++ have static analysis, ASan, MSan, UBSan. With thousands of false positives with one true positive on your static analysis tool. ASan catching your memory errors (maybe) and telling you the rough location if you exercise the right part of your code in your unit tests. UBSan doing the same for undefined behavior. Never mind these are all separate compiles that only warn you after ages of running on your Jenkins server. The package manager is a joy to work with and supports multiple versions of tools. The edition mechanism allows the language not to be dragged down by old cruft. The proc macros make it possible to have insanely reusable libraries, like serde. The normal macros are part of the AST so you don't make stupid mistakes that are hard to trace. Rust is just so good. But I think it's only obvious if you've worked with C++. Most of this doesn't seem special coming from C#. Except the performance that is possible. The borrow checker might cost you a few minutes, but it can save you days or even weeks of debugging, and maybe it will save lives some day when Rust makes it to safety critical applications. One thing that did bother me for a long time was RLS auto complete, which was just really slow and useless. This has been fixed with the advent of rust analyzer.
- b0sk 6y agoI know exactly what you feel. I am kind of in the same boat (I am a C++ developer trying out rust). One example is the lifetime specification makes it look like code from the code golf languages i.e. "&'a mut" However, this sense is reducing every-time I see an example of some idiomatic Rust code. I appreciate that they've addressed a lot of C++ pain points. 1. Traits are awesome. (Simon Brand: How Rust gets polymorphism right - https://www.youtube.com/watch?v=VSlBhAOLtFA https://www.youtube.com/watch?v=VSlBhAOLtFA) 2. The lazy pipeline styled programming is idiomatic and produces optimal assembly. (Ranges in C++20 ) 3. Extremely powerful enums. Straight out of functional langs. These are only a few of the things top of my mind but it makes me appreciate Rust more and more.
- msla 6y agoI used to fight with the Haskell compiler until I began to understand how it did things and what it expected and now I only fight with the compiler when I'm genuinely confused about something. I wonder how long it takes to achieve the same level with Rust.
- baby 6y agoI’d say it takes some time. Golang was definitely faster to spark joy for me.
- trevor-e 6y agoI'm really hoping Swift breaks out of the app ecosystem soon and becomes mainstream on Linux, it's a joy to write and has a great compiler team behind it. Still missing some big features but I think they will be solved in Swift6.
- kevsim 6y agoFully agree. It's a couple of years since I've used it, but Swift just feels great. Guard clauses, optional chaining, and many other features just seem to fit the way I like to write code. It's not without its warts, but it's one of my favorite languages syntactically.
- moreaccountspls 6y agoI kinda feel the same. For me, it's because most of the stuff I work on aren't real time systems, so go level GC pauses are acceptable. The mental tax of worrying about ownership just gets in the way of solving the problem in this case. For what it's worth, I've done Haskell professionally, and nowadays I'm not in love with it either. If I was working on something where the best alternative is C++, I'd probably feel different. Right tool for the job and all of that.
- estebank 6y agoI don't want to pile on, as quite a few people have already commented under this comment, but I would really like to know why you feel the compiler is "grumpy". Others and I have spent a lot of time trying to make the diagnostics clear, understandable, friendly and actionable. If there are cases we are failing at doing that, I would be more than happy to hear about them! I hope it's not the tone, but rather how nitpicky the language feels, but the target is for most of the seemingly pedantic or arbitrary restrictions to give you guidance on what needs to be done instead.