#OCaml tip: when you function takes several arguments of the same type (e.g. two booleans), or even generic types (e.g. 'a and 'b) that in practice would be non-disjoint in callers, use labeled arguments. This way, you'll avoid bugs due to inadvertently mixing up arguments.
-
-
Replying to @Ngnghm
The alternative is to create new opaque types that are boolean underneath and rely on constructors.
2 replies 0 retweets 0 likes -
Replying to @phil_eaton
Sometimes the types aren't opaque for the client. In this case, the only client was a recursive call, and I wanted to be sure I wasn't getting the order of arguments subtly wrong.
1 reply 0 retweets 0 likes -
Replying to @Ngnghm
You can create/use new opaque types at any point, no?
1 reply 0 retweets 0 likes -
Replying to @phil_eaton
In this case, they must NOT be opaque, just distinct. I use an && between those two booleans. Don't make me reinvent that with pattern-matching. The labels are lightweight just-in-time constructors for distinct types, also deconstructed just-in-time. Just what the doctor ordered.
2 replies 0 retweets 0 likes
One bad point for #OCaml: the syntax for calling and defining functions with labels isn't the same as the syntax for building and matching records.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!