Cute/evil trick for writing a Rust script using a shell header that's a valid Rust comment!
https://neosmart.net/blog/2020/self-compiling-rust-code/
Related Posts
When writing long-lived programs (daemons etc) in Rust, I find myself asking *where* I should put data.
In a GC'd language it's just "I have a string" but Rust forces me to find somewhere to put it.
You do get a performance benefit for this work though.
It's interesting to see the "why not Rust?" discussions around the TypeScript news that they're using Go. It shows that Rust has reached a level of maturity that it's a default for some users.
Go does seem to be in a sweet spot for AOT languages with GC though.
TIL Rust has an ambiguity `if Foo {}` -- is `Foo` a value of type bool, or a struct?
Rust solves this by defining a grammar production 'any expression except struct literals' and using it in this position. https://rust-lang.github.io/rfcs/0092-struct-grammar.html