3 ms·
Is there any convention for denoting which functions in OCaml have side effects?
by badfrog 8y ago
Is there any convention for denoting which functions in OCaml have side effects?
- fiddlerwoaroof 8y agoI don't know, I don't write it very much.
- yawaramin 8y agoSome people append `_exn` to names of functions which can raise exceptions; that's about it.
- laylomo2 8y agoNot really, but the documentation will usually tell you. Also, at least in Jane Street’a libraries, exceptionful functions always end in _exn. So for example there is List.find and List.find_exn
- craigsmansion 8y agoI don't think it's a strict convention, but it's common to see (a block of) imperative statements with side effects enclosed in: begin ... end It's ugly and stands out in its awkwardness, almost as if by design, with the compiler saying: "I will let you do this, but do think about it some more and try and come up with something more elegant."