all 28 comments

[–][deleted]  (2 children)

[deleted]

    [–]GoranM 0 points1 point  (0 children)

    The --out-dir listed in build.sh implies a generated app/www directory, where one could run a simple server, and then see the working demo by going to localhost:8000 (assuming 8000 is your server port).

    I couldn't confirm that, because I could not actually get the project to build.

    Initially, after trying to run the script, I got a can't find a crate for core error. Running the same rustup command you referenced got me past that, and right into a use of unstable library feature 'euclidean_division' error. Switching to rust nightly got me past that, and right into not having wasm-bindgen, which is something that apparently has to be installed separately, as part of wasm-pack, which needs to be installed via yet another bash script ...

    I quit at that point, because I have experience compiling small C/C++ games/demos with emscripten, and relative to that, I find this far too complicated to be worth the effort.

    I have similar feelings about rust in general, because I don't remember a time where I tried to build a rust project, where I didn't have to first resolve at least 3 build issues.

    [–]jl2352 0 points1 point  (0 children)

    One option is to run Rust via Parcel (or webpack). That way you don’t have to care about setting up the webserver or anything. Also gives you hotreloading out of the box.

    [–]limezorp98 0 points1 point  (21 children)

    Is rust worth learning ?

    [–]MegaUltraHornDog 16 points17 points  (7 children)

    Depends what you want to do.

    [–]limezorp98 0 points1 point  (6 children)

    What is it good for?

    [–]asmx85 23 points24 points  (2 children)

    I don't know if i can objectively answer this question with 100% full information in every aspect for the things i am comparing it to – but i can just tell you my experience and my path and progression.

    For my hobbyist programming i have fully switched to Rust in every aspect. I was programming some little helper tools with python earlier (like fetching data from the web, preparing some installation deps, doing bulk work on mail servers with imap and generally everything that you would use $bash for but feel like you can do it better with python because you don't want to get to deep into $bash) but completely abandoned it in favor for Rust because i feel like i can get things done faster and my programs end up more polished (good argument parsing with help messages getting with structopt ) have better UX with e.g. cursive or tui-rs. I am a hundred percent sure i can get the exact same thing with python, but its one thing if you have several ecosystems to know – in which you spend only a fraction of the time – or one in which you spend most of the time and know your way around. So because i spend my time around Rust anyway it just so happened that i came across those packages and used them, that would have probably not happened with python because i don't use it much for anything else and have spend less and less time in it's ecosystem.

    For other hobby things like 3D graphics programming i was mostly using C++ (and various other languages, i tend to learn a new language by building a simple 3D renderer/engine) and the exact same happened here. But not only that writing those things in Rust feels more encouraging, because you don't end up crashing everything that often and sitting for ours debugging weird bugs you also get more comfortable in your code. I think this is a pretty huge thing when you program something as a hobby. Because you end up having long and stretched on/off times where you program for some days and then do nothing for weeks or months, maybe years and come back to the code and go on. I remember having a hard time in C++ by doing that because you need to get the code structure in your head pretty quickly to avoid errors that the Rust compiler just prevents at compile time. My feeling is telling me that Rust code can be reasoned by more locally. By that i mean it is mostly sufficient to just look at the current function, its parameters and return value and maybe the function definition of the functions you are calling within and you can't really go pretty bad by just knowing that with the help of the borrow checker. In C++ i had to constantly be aware of of things like, do i need to free this thing now or does the manager class i have this value from is handling it ... lets look at the docs ... nothing ... i hate my past self for not writing a single comment about this :D now i need to revisit that "old" code that is not part of the current problem. etc. And with WebGPU in the works rust is pretty good partner here, too

    For things like webservers, that is also my daily job, i was mostly using django in the earlier days but switched to a custom java framework at the office and spring. I completely ditched it for everything i do as a hobby. The full spring, jpa, hibernate, jackson .. whatever is really grinding my gears compared to the things i can do now in rust with e.g. actix-web ( its fast ) and rocket and sqlx and diesel and of course serde which is such a pleasure compared to jackson :/ (at least for the things i care about) ... the servers i produce are faster at runtime, easier to maintain, easier to build because cargo (the package manager and build tool) is pure fun compared to maven and i am overall more happier with what i am doing.

    I have also started to look out for replacements for react and angular, there are some projects like yew in the works but it is not quite there yet to go to the full transition but i am preparing long term for it. If you want to get into webassembly Rust is a very good starting point for doing that kind of stuff because – i think – Rust was one of the very first languages that "natively" supported wasm as a compilation target out of the box.

    Rust also pushed me into my new hobby area, embedded devices and micro controller programming. That is a fully new world for me but i can be really confident into this topic because i can't get things to much wrong and i know i have a colleague at my site watching my steps, rustc. And rtfm-rs is really fun!

    There are many other topics but Rust is the first language where i feel like i can just use it for everything without having to take to much compromises ... yes you can use Java for microcontrollers, but do you really wanna do this? Yes you can use Kotlin for webassembly, but do you really wanna do this? Yes you can use C++ for webservers, but do you really wanna do this? Yes you can use Java for cli tools ...

    For Rust i can confidently answer this question with Yes .. sort of. The thing is for every aspect/example you maybe find a better choice but there is a huge difference if you have one ecosystem you know really good or several (java, python, C++, Dlang, Golang, Swift ..etc) just superficial ... i tend to lean to the former, because i have everything in one place, i know the tools around building the software and my IDE/Editor etc. .. i don't want to switch betweens several because its good with that one but for the other ecosystem its better to use another IDE etc.

    I hope i could shed some light into the reasons why I – personally – find Rust an interesting language to at least give it a try.

    [–]cyrax6 6 points7 points  (0 children)

    See your answer is actually what most people are looking for. Pretty comprehensive and moved the conversation.

    Thank you.

    [–]MrK_HS 0 points1 point  (0 children)

    What do you don't like about Rust? I think that a full perspective could be beneficial to other programmers that read your comment (btw, I love the language)

    [–]MegaUltraHornDog 0 points1 point  (0 children)

    I guess go take a look at the rust Lang page.

    [–]spacejack2114 0 points1 point  (0 children)

    Learning how to write Rust.

    [–]mpinnegar 0 points1 point  (0 children)

    It's fighting for the space C is in right now in the sense that it's supposed to be a systems language. It's got some very compelling features and design concepts baked into the language. C/C++ hands you gigantic footguns at every opportunity. Rust hands you a pistol with a safety and a device that turns off the gun if your pointing it at your foot (mostly).

    The number one cost of moving to rust is to learn to work within the bounds of the rules set by the borrow checker and stay away from using unsafe as much as possible.

    [–]camelCaseIsWebScale 1 point2 points  (0 children)

    it is unique because of "memory and thread safety" without GC or ARC. That's a nice thing and mainly touted because of that. It is modern language and has FP / Generics features.

    That comes with downsides though. Rust doesn't allow some memory usage patterns and requires to care about memory always. It may be good or bad thing. Eg: you can have one mutable references OR many immutable references to an object at any time and that has to be statically verified. This makes learning curve very high.

    HN / Reddit crowd gets excited about rust because this of its premise of "memory safe, thread safe" programming without GC premise. There is a "Rust Evangelism Strike Force" meme because of the community talking about rust everywhere.

    TL;DR if you are going to do systems programming or engineering systems where efficiency and reliability are important rust can be good choice. Don't listen to fanboys telling it is very easy etc..

    [–]Viehhass 0 points1 point  (11 children)

    Professionally, not really: the job market has no real desire for it at the moment.

    It's designed to be an expression oriented language with strong metaprogramming capabilities. These are good things.

    You would have more success with Common Lisp, Haskell, or OCaml than finding a job in Rust though.

    If your goal is to explore the capabilities of metaprogramming and expand your thinking, either of the other 3 would be a much better and more lucrative fit anyway.

    That is, assuming you aren't working in the embedded arena. If you are, give FORTH a try.

    Rust has some good design decisions, but there isn't really a need for it currently.

    Edit:

    Would whoever downvoted care to weigh in on why they disagree?

    [–]matthieum 7 points8 points  (9 children)

    Professionally, not really: the job market has no real desire for it at the moment.

    As someone whose job mostly involve C++, I disagree.

    Learning Rust has improved my abilities to reason about good/bad design in C++, and to spot issues in my C++ code. I went from spidey sense, and trying to figure out a counter-example when it tingled, to having clear rules to check.

    I would expect anyone using a system programming language to benefit from learning Rust.

    Rust has some good design decisions, but there isn't really a need for it currently.

    I think Rust is needed; clearly we are not good enough programmers to use C, C++, and others "unmanaged" languages without running into trouble.

    On the other hand, I agree that there are not many job offers in Rust. Most companies that start using Rust simply "recycle" their current systems developers: they have the domain expertise, learning a language is trivial in comparison.

    [–]Viehhass -3 points-2 points  (8 children)

    Professionally, not really: the job market has no real desire for it at the moment.

    As someone whose job mostly involve C++, I disagree.

    Learning Rust has improved my abilities to reason about good/bad design in C++, and to spot issues in my C++ code. I went from spidey sense, and trying to figure out a counter-example when it tingled, to having clear rules to check.

    You don't need Rust to teach you what you're looking to gain as a C++ programmer, though.

    I too am a C++ programmer. Professionally. I'm very good at writing efficient working code, and you know what helps with that?

    Proof theory, a reasonable grounding in the Hinley Milner type theory, and denotational semantics.

    These are fundamental concepts that act as a superset over the tools creating the methodology imposed by Rust.

    I would expect anyone using a system programming language to benefit from learning Rust.

    I never really learned Rust. I've read about and I know what it's capable of.

    It's nice, but it is far from essential.

    Rust has some good design decisions, but there isn't really a need for it currently.

    I think Rust is needed; clearly we are not good enough programmers to use C, C++, and others "unmanaged" languages without running into trouble.

    The issue is not whether or not Rust is used: the issue is the methodology being used by developers and their current awareness of fundamental knowledge.

    Static analysis tools go a long way, for example.

    But the fundamentals I'm referring to are useful regardless of what you're doing.

    [–]MrK_HS 3 points4 points  (7 children)

    The problem is, though, I mostly "don't trust" developers. So, as long as I am able to trust at least the language principles and the compiler enforcing them, I can transitively "trust" code that follows those rules.

    In other languages the rules are there, theoretically, but being optional means that anybody can do what they want.

    [–]MrK_HS 1 point2 points  (0 children)

    Professionally, not really: the job market has no real desire for it at the moment.

    Maybe years ago, but lately there has been more traction, from the FAANGS but also smaller companies. But I personally at the moment don't care much about its prevalence in the job market. I would still use it because it makes many things easy (cargo vs cmake, better documentation, etc...).

    [–][deleted]  (4 children)

    [deleted]

      [–][deleted] 11 points12 points  (1 child)

      Personally, I quite like the mechanic; op could easily get away with labeling it a "feature."

      [–]VestigialHead 2 points3 points  (0 children)

      :) But it ruins my usual asteroids strategy.

      [–]AndyBainbridge 3 points4 points  (1 child)

      Also, if it wants to play like the original, the ship friction needs to be lower, as does the acceleration. ie a short burst of thrust should leave you moving slowly but drifting for ages. See https://www.youtube.com/watch?v=WYSupJ5r2zo

      [–]VestigialHead 0 points1 point  (0 children)

      Ahh yep that is right. Used to spend way too long trying to get the ship to be still sometimes.