Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rust is a better choice


It depends on _for what_. The most important part of these discussions often leaves out this important part.

I use go as a python replacement for the most part and it’s brilliant at it. Types, compiled, good collection of external libraries and easy to read. For most of my scripting or mini projects I’m not willing to use C++ and by the same thought, I’m not willing to use rust either.


While I am no fan of Go, Rust is not a better alternative for most use cases of the average Go program. A better alternative would more likely be Java/Kotlin/Scala/C#. All with proper generics, good standard libraries/ecosystems, and fast run times.


What if you need to compile to native? Some places don't accept having to have a VM like .NET or Java installed to run.


.Net Core compiles to native and can be packaged to not need common runtime installed. And targets linux. You can even have it create a single file executable though admittedly it unpacks to temp folder at runtime if you do this. Down side is everything is like 80 MB minimum if you do this.


.Net has CoreRT to compile to native and the JVM has Graal Native Image.

I've had success deploying native services using Quarkus [0] for Java.

Additionally in modern java you would use jlink [1] to produce a minimal jvm image that ships with your application. No need to install.

[0] https://quarkus.io/

[1] https://docs.oracle.com/en/java/javase/11/tools/jlink.html


Also GC is a real no-no for real-time.


Go has a GC. Specifying the need for manual memory-management might be moving the goal-posts a bit.

Edit Phone auto-correct from memory management to measurement.


To be fair, it's possible to write code that does no heap allocation in each of these languages. None of them guard against mistakes that create GC work, and Java would not be my choice for this.


True. I've even had the "interesting" experience of writing low-allocation JavaScript (for 3D mostly).


Please expand more on why Rust "is a better choice"?

I'm still not convinced by this statement.


For what? Usually absolutes are not very useful...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: