34
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 09 Jul 2026
34 points (88.6% liked)
Programming
27651 readers
127 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 3 years ago
MODERATORS
"Const by default" is good style BTW.
I was doing Bash and Python, when a few years ago learned Rust. The const by default was mind blowing how much better it was. I wish Python had const by default too.
It has for strings and tuples, which are immutable.
If you want your mind blown a lot more, try a bit of Clojure, with its persistent data types for collections like lists, vectors and dictionaries, and fantastic concurrency support. It is a class of its own.
And if you want to combine these principles for calling Rust, using Racket or Guile might be nice - Scheme does not demands immutability like Clojure, but it prefers it, and the lispy languages have a close relationship with Rust's predecessor OCaml. And they can call into Rust code via its C ABI.
(Also Guile and Racket have a bit less library support than Python, but Guile has a great package manager, Guix, and good access to POSIX interfaces.)
Ehm, that's not mind blowing at all? I think there is some misundestanding. I am not talking about Strings and Tuples alone, but a global rule for all types as being immutable by default. And it would be nice to have a way to tell ANY variable to be immutable.
I'm not sure what "prefers" means in this context; do you mean it "defaults" to? Rust in example doesn't "demand" immutability, it just defaults to it. I had looked into Clojure for a while, but I don't like Lisp.
Just for good measure, I think Odin and Scala are also interesting languages. Whats interesting about Scala is, it can output Java Bytecode, JavaScript and native compiled code. Odin on the other hand seems to be a mixture of C and Python, but I didn't look any further.
In Clojure, all standard data types are immutable. (Except Java arrays, which are accesible; Clojure's vector type is immutable too). If you need mutable containers, there are transients, which do have methods for mutating access. But these need to be "frozen" into normal collections before they are e.g. returned from a function; their scope is strictly local to a function.
Schemes are a bit more liberal, you can modify variables in Scheme but it is not idiomatic. Like in Clojure, recursion is often used over iteration. Also, e.g. in Racket, you have a lot of things like list conprehensions or dictionary comprehensions in Python.
Common Lisp is even more liberal; one can use a purely functional style but it wholly depends on own discipline.
So, Lisps might not be your cup of tea; Scala is pretty close in these aspects.
But Lisps are fantastic languages; Minimalist, very expressive, very performant implementations like SBCL or Guile, and run on many kinds of substrate, like the JVM (Clojure, Kawa, Armed Bear), native/POSIX(SBCL, Guile and many more), JavaScript (ClojureScript), GraalVM (babashka), the Python bytecode machine (basilisp), and so on.
OP should try Python or JS, everything is mutable there.
But Common Lisp is more mutable (and way faster than Python).
Just sayin' .