4 ms·
Out of curiosity, what is the use case for immutable structs? (asking as I'm a ruby/js/go dev and as such I've never used such idiom)
by oelmekki 9y ago
Out of curiosity, what is the use case for immutable structs? (asking as I'm a ruby/js/go dev and as such I've never used such idiom)
- falcolas 9y agoIt's a code safety thing. If you create it and the compiler makes it immutable, then you can't screw it up later with an accidental mutation. Basically, something that takes coder discipline in Ruby/JS/Go is handled a compiler/runtime enforced restriction.
- oelmekki 9y agoOh, I see, thanks. I get now how it can be a problem when you're used to rely on it and it's not in the language.