4 ms·
Not to mention you get a language that is enjoyable but also compiles to native code. My first Rust project was a Haml parser and I created a CLI for it too tha
by jetti 8y ago
Not to mention you get a language that is enjoyable but also compiles to native code. My first Rust project was a Haml parser and I created a CLI for it too that is similar to the Ruby version. It is nice being able to ship the 8Mb executable and not have to worry about users having the right runtime.
- pjmlp 8y agoJust like any other compiled language. GCC's static linking issues with glibc don't apply to other compilers.
- jetti 8y agoNo, not like any other compiled language. Just like any other native compiled language, maybe, but Java and C# are also compiled yet require a large runtime in order to run any application. An 8Mb executable written in Rust is going to be 8Mb total. An 8Mb executable written in C# or Java is going to weigh much more than that when you take into account the framework. Now, one could argue that it is almost a given for the JVM to be installed on a given computer but you can't say the same for .NET when doing cross-platform development.
- pjmlp 8y agoJava and C# are also native compiled languages, with linker support. You just have to look properly for those options. The only thing is that not all of them are free beer.
- carlmr 8y agoAlso don't forget Cargo. It makes it so much easier to work with than installing C/C++ dependencies.
- jetti 8y agoCargo is awesome too. Cargo reminds me of Mix (from the Elixir ecosystem). The one thing that Mix has on Cargo is that it is super simple and straight forward to extend Mix. Cargo may be the same way but from what I've seen it seems more complicated.
- steveklabnik 8y agoThat’d make sense given the common ancestry in Bundler :) Do you have any docs on what you mean by extensibility here? I’m curious!
- jetti 8y agoSure! Take a look at Mix.Task [0]. You basically name your module Mix.Tasks.X where X is whatever you want the command to be and then include "use Mix.Task" and implement the run function and you have now extended Mix. You call the task my running "mix X" and it will run the code in the run function. I created a small task that generates ORM models for Ecto (Elixir's de facto ORM library) using Mix tasks [1]. So the user types mix plsm and they can generate the code. [0] https://hexdocs.pm/mix/Mix.Task.html https://hexdocs.pm/mix/Mix.Task.html [1] https://github.com/jhartwell/Plsm https://github.com/jhartwell/Plsm
- steveklabnik 8y agoAh ha! Thanks. So yeah, if you have an executable in your PATH named cargo-foo, then “cargo foo” will execute it. But we’re planning on having that style of functionality in the future as well, the cod name is “tasks”, but it still doesn’t have an RFC.
- jetti 8y agoI'll definitely want to check out that RFC when/if it opens up. I didn't realize that cargo did that with the executables, that's good to know. Thanks!