I’ve been struggling with case analysis in Swift. On the one hand,
switch is powerful and flexible; on the other hand, it can force convoluted control flow, it requires a lot of boilerplate, and it can’t pattern match into structures or classes.
Case analysis methods, meanwhile, can avoid some o... (more)
Following on the heels of Andy’s article about value types, I wrote about making responsible use of value types when dealing with incidental, unobservable effects. (If a procedure mutates local state in the forest and no other actor has any reference through which to observe these effects, does i... (more) I wrote an article for objc.io about the architectural benefits of value types. It's ostensibly about Swift, but the concepts are really much more general.
The pitch: types with value semantics (i.e. copied anew to each l-value) are naturally inert, isolated, and interchangeable. For straight lo... (more)