☆ Yσɠƚԋσʂ ☆

  • 44 Posts
  • 20 Comments
Joined 5 years ago
cake
Cake day: January 18th, 2020

help-circle
  • Functional programming tends to get conflated with static typing and immutability, but it’s a much broader paradigm than that. I find it really depends on the specific language. It’s very easy to do local mutation in Clojure for example. There are constructs like transient specifically designed for doing that. There are also languages like Janet that are functional, but use mutable constructs by default and can embed in C with very low footprint.

    I generally get annoyed with software being slow to startup and hogging resources as well, but that’s a separate discussion. The JVM is designed primarily for servers where you have long running processes, and startup time isn’t really a big concern. So, it’s not the best illustration. A CL app written using something like clog will be very snappy.

    Joe Armstrong made a good point a while back as well. He pointed out that it’s better to focus on making the compiler smarter so that it can do the optimize performance, and optimize languages for human readability. I very much agree with that sentiment. We can see an example of that being done with GraalVM which can compile JVM bytecode into optimized native apps that have very fast startup time and use far less resources than the JVM. At the moment it’s not comprehensive, but you can make GUI apps with it, and they’ll even run on RPi.






  • Typically this is true, but it’s certainly possible to get comparable performance with functional style. Carp, which I linked above, basically uses the same approach to memory management as Rust. It doesn’t rely on GC.

    I also find that for most cases it really doesn’t matter all that much unless you’re in a specific domain like writing drivers, making a game engine, etc. Computers are plenty fast nowadays, and ergonomics tend to be more important than raw performance.






  • Rust solves a specific problem, and it’s good at letting you write correct programs with low resource usage. It’s definitely a huge improvement on C and C++.

    That said, I find a language like Clojure is far more productive because it’s more expressive, and development is done interactively. With Clojure, you start up your program, connect the editor to it, and evaluate code as you go seeing changes live. Once you’ve worked this way, it’s really hard to go back to having to compile your whole program each time you want to see what it’s doing. It’s like having a conversation with the compiler. It makes it very easy to experiment with different ways to solve a problem, and it gives a lot of confidence because you always see exactly what the code is doing. Clojure also interops with JVM and Js runtimes, so those entire ecosystems are available for use.

    Incidentally, there’s a Lisp style language that embraces a lot of Rust principles. https://github.com/carp-lang/Carp