Notes (OFVB 13/31): Putting Things in Boxes

There is an erratum in the the file_statistics declaration: file_statistics_channel should be channel_statistics.

I kind of like the way mutation and array syntax works. It’s very imperative, but very accessible. In Haskell, we’d do something with Vector, MVector or MVar, which are all a little more conceptually complicated. I suspect that complexity is actually just inherent in mutation, so learning the various Haskell mutation types IORef, MVar, TVar, are actually really useful, whereas I suspect the OCaml abstraction might be trading off immediate ease of use for complexity wrinkles later on. That’s only a supposition though, we’ll see how that plays out as I learn more.

Questions

1

2

The difference is that in the first case we have a list of two different references, whereas the second is a list of two identical references. So updating either reference in the second list changes the value the other ref points to, because both refs point to the same place.