3 ms·
> well-encapsulated types via their public APIs cannot violate invariants … of those well-encapsulated types. Throwing an exception like this cannot break an i
by Spivak 5y ago
> well-encapsulated types via their public APIs cannot violate invariants
… of those well-encapsulated types. Throwing an exception like this cannot break an internal invariant of the list object which is what the author is saying.
You can’t break the list object which sounds crazy by modern standards but in languages without this kind of encapsulation (like C) this can and does happen.
- lalaithion 5y agoThat's a very useful guarantee, I agree, but it's not a good enough reason to not have "try" as a syntax.