Live data from Hacker News

Rust for Clojurists

gist.github.com

11–20 of 44 posts

Re: Rust for Clojurists

#11
post #4

Good article. He missed out the main pro though (and literally the only reason I ever use any Lisp): hot swapping. The ability to change code on the fly as the program is running. For this to actually work you need 2 things: 1. No explicit types: Everything in Clojure is just a list or hash map, so I can add extra members to anything at runtime no problem. The amount of static checks Rust does at compile time makes t…

You don't need dynamic types to allow hot reloading, as long as a function has the same absolute path and type signature it can be done. I'm pretty sure miri[0] plus some compiler hooks would allow this, although it would need to reach nearly speed-parity with debug code if not release code. Hot reloading and/or repl-driven development is my number one programming desire right now, and Rust is my most-used language, so this would be life-changing for me.

Also, Scheme and CL allow free reign on data mutation and RDD/HS work fantastically in them

[0]: https://github.com/solson/miri

Re: Rust for Clojurists

#12
post #4

Good article. He missed out the main pro though (and literally the only reason I ever use any Lisp): hot swapping. The ability to change code on the fly as the program is running. For this to actually work you need 2 things: 1. No explicit types: Everything in Clojure is just a list or hash map, so I can add extra members to anything at runtime no problem. The amount of static checks Rust does at compile time makes t…

You don't need dynamic types to allow hot reloading, as long as a function has the same absolute path and type signature it can be done. I'm pretty sure miri[0] plus some compiler hooks would allow this, although it would need to reach nearly speed-parity with debug code if not release code. Hot reloading and/or repl-driven development is my number one programming desire right now, and Rust is my most-used language,…

I didn't say it wasn't possible, but I've found that hot-swapping in languages that use mutable data structures, and have heavy type systems, makes for a poor experience. If I can constantly cripple the runtime with hot-swapping, or I can't change any type definitions, then there is little point to it.

Re: Rust for Clojurists

#13
post #4

Good article. He missed out the main pro though (and literally the only reason I ever use any Lisp): hot swapping. The ability to change code on the fly as the program is running. For this to actually work you need 2 things: 1. No explicit types: Everything in Clojure is just a list or hash map, so I can add extra members to anything at runtime no problem. The amount of static checks Rust does at compile time makes t…

In which scenarios do you use hot swapping?

Just about every scenario? Any algorithm I am working on, any function, any config variable I want to tweak in real time, any GUI I am developing, and so on.

Re: Rust for Clojurists

#14
+1 for this gem right here. Well done!

"Many people try to compare Rust to Go, but this is flawed. Go is an ancient board game that emphasizes strategy. Rust is more appropriately compared to Chess, a board game focused on low-level tactics. Clojure, with its high-level purview, is a better analogy to the enduring game of stones."

Re: Rust for Clojurists

#15
post #4

Good article. He missed out the main pro though (and literally the only reason I ever use any Lisp): hot swapping. The ability to change code on the fly as the program is running. For this to actually work you need 2 things: 1. No explicit types: Everything in Clojure is just a list or hash map, so I can add extra members to anything at runtime no problem. The amount of static checks Rust does at compile time makes t…

In which scenarios do you use hot swapping?

Clojure has a very REPL-driven workflow, where you connect your editor to a REPL (usually emacs+cider) and get instant feedback about anything, reload code on the fly, and inspect your program's state. This is a fundamental concept of pretty much any LISP, and is lacking in rust.

Re: Rust for Clojurists

#16
post #4

Good article. He missed out the main pro though (and literally the only reason I ever use any Lisp): hot swapping. The ability to change code on the fly as the program is running. For this to actually work you need 2 things: 1. No explicit types: Everything in Clojure is just a list or hash map, so I can add extra members to anything at runtime no problem. The amount of static checks Rust does at compile time makes t…

The BEAM and particularly Elixir satisfy all of the above., 0 is supported in the VM by releases, though admittedly probably not to your satisfaction. 1 is true in Elixir. Structs are just maps with a __struct__ key under the hood, though you can't arbitrarily add things here. I think this is true with defstruct in clojure, as well. 2 is true in Elixir, except via message passing between lightweight processes, which then return NEW state (of any shape) representing their current state at the end when you invoke their functions. And we have hygienic macros =)

Re: Rust for Clojurists

#17
> You're in an industry reaping disproportionate benefit from loose money policies, leading to a trend-chasing culture of overpaid nerds making web apps. You feel guilty about this, but there is nothing you can do about it because you have no other talents that a rational person would pay you for.

/r/2meirl4meirl

But in all seriousness, this was a great article and an exceptionally fun read!

Re: Rust for Clojurists

#18

Earlier quoted context omitted.

You don't need dynamic types to allow hot reloading, as long as a function has the same absolute path and type signature it can be done. I'm pretty sure miri[0] plus some compiler hooks would allow this, although it would need to reach nearly speed-parity with debug code if not release code. Hot reloading and/or repl-driven development is my number one programming desire right now, and Rust is my most-used language,…

I didn't say it wasn't possible, but I've found that hot-swapping in languages that use mutable data structures, and have heavy type systems, makes for a poor experience. If I can constantly cripple the runtime with hot-swapping, or I can't change any type definitions, then there is little point to it.

Typed/racket supports hot swapping to a similar degree as clojure

Re: Rust for Clojurists

#19
Nice. My biggest problem with Rust is the poor performance and lack of complete & sane libraries, especially for HTTP.

I was running into serious issues with the following code:

https://gist.github.com/l1x/5678c0fdfc2c1a6034b8bcc3800de93c

Its performance is saturated around 60K req/s on a 32 core box with 10G networking while wrk was more than happy to do 3M req/s. I was trying to dig further into why it is slow and it seems that hyper is the culprit. However, I was not able to come by this issue and just used wrk2 for testing. Let me know if anybody has insight into how to go beyond this perfroamance or what are the issues with my code.

Re: Rust for Clojurists

#20
post #7

> Rust chose to call its [package] format "crates". This reflects the language's industrial roots and the humble, blue collar town of its sponsor: Mountain View, California. Nice :)

The terminology there was actually inspired by the fact that Grayson Hoare would walk to work along the docks in Vancouver, passing the shipping crates as he went.
Post reply on HN