Re:Show HN: Rust Web Framework
by albrewer on Wednesday October 23, 2024 @12:33PM
(#41926681)
> Probably Java and Python have similar constructs
In Python, the closest you can get is a "frozen" dataclass, but you don't get true immutability[0]. What you _do_ get is effective enough for just about all practical use cases, except for the standard foot guns around mutable data structures.
Re:Show HN: Rust Web Framework
by hansvm on Wednesday October 23, 2024 @04:23PM
(#41928956)
You can redefine the byte representation `True` corresponds to in python. "Immutable enough" is all you're really looking for; it somebody goes out of their way to mutate the thing then they probably had a good reason for it.
In Python, the closest you can get is a "frozen" dataclass, but you don't get true immutability[0]. What you _do_ get is effective enough for just about all practical use cases, except for the standard foot guns around mutable data structures.
[0]: https://docs.python.org/3/library/dataclasses.html#frozen-in...