3 ms·
Its immutable everywhere, or just outside the package that declares it?
by jeremyjh 8y ago
Its immutable everywhere, or just outside the package that declares it?
- jerf 8y agoOutside the package that declares it, though if you have it as an interface value you'd have to do work to penetrate it. Since it's not like I'm trying to sell this as a solution to all immutable data requirements, I didn't worry too much about that detail. In the end it's all about effort, anyhow; with the right invocations in Haskell I can mutate "immutable" data just fine. So even an interface in the package that declared it is still nontrivial protection against accidentally mutating it.
- RyanZAG 8y agoWhat about lists? Eg, an immutable list of packets.
- jeremyjh 8y agoI don't think thats really true about Haskell, unless you are talking about C code you've invoked through FFI in which case all bets are off in every language. Isn't it a lot simpler to just say that Go has no feature support for immutable data? The fact that you can hide accessors in a package is small comfort if I have to read all the source code in that package to know the actual semantics.