Steve Schveighoffer wrote:
Walter: Use invariant when you can, it's the best!
User: ok, how do I use it?
Walter: You need to cast mutable data to invariant, but it's on you to make sure nobody changes the original mutable data. Casting circumvents the typesystem, so the compiler can't help you.
User: :(

Unfortunately, we could not come up with a typesafe scheme for going from mutable to immutable that was reasonable. The transition is up to the user to do correctly, but it isn't a terrible burden, and is simple to get right.

Reply via email to