• 1 Post
  • 22 Comments
Joined 1 year ago
cake
Cake day: June 28th, 2023

help-circle





  • Although I do believe Javascript is a mess, I’d have to disagree with that. The problem with Javascript and to an extent all client side code is that people uses as a everything tool not neccesarily the language being at fault. People should start to realize handling logic on the backend is perfectly fine and is often better as you don’t need to send several megabytes just to load a simple web page. If we decided to replace Javascript with Python we just recreate the same problem that plagues the modern web.









  • Answering my own question here. If you don’t have any interest in how the tools you use work, programming isn’t “for you” (take that with a grain of salt). If you are writing code and have never looked into how compilers/interpreters work or are using a library and haven’t even taken a peak at the library’s source code you should because it will make you a better programmer in the long run. And I’m not saying you can’t get anything done without that curiosity but curiosity is a major part of being a programmer. Also you don’t need to have a deep understanding of the tool just a overview of what it’s doing. Like for a compiler understanding what lexers, parsers, ASTs, code generators are will allow you to write code with that in mind.






  • Perhaps garbage collection is the wrong term to use as it dosen’t happen at runtime (I wasn’t sure what other term to call what Rust does). But Rust does provide a abstraction over manual manual memory management and if you are experienced with Rust sure you can probably visualize where the compiler would put the malloc and free calls so it is kind of a mix where you do technically have control it is just hidden from you.

    Edit: It seems the term is just compile-time garbage collection so maybe you could consider it falling under garbage collection as an umbrella term.


  • Essentially although there are a few key differences:

    • In Rust there always only one owner while in C++ you can leak ownership if you are using shared_ptr.
    • In Rust you can borrow references you do not own safely and in C++ there is no gurantee a unique_ptr can be shared safely.
    • In Rust, A lot more compile time optimization for the borrow checker is available whereas in C++ the type system dosen’t always let the compiler know for sure when an object goes out of scope, is moved, or is destroyed and so you miss out on a lot of optimization that would be trivial with Rust like syntax.