Re:Functional Programming in OCaml
by badfrog on Saturday March 02, 2019 @10:22PM
(#19292505)
Is there any convention for denoting which functions in OCaml have side effects?
[ Parent
| on HN ]
Not 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
Some people append `_exn` to names of functions which can raise exceptions; that's about it.
Re:Functional Programming in OCaml
by craigsmansion on Sunday March 03, 2019 @04:46AM
(#19293644)
I 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."
Re:Functional Programming in OCaml
by fiddlerwoaroof on Saturday March 02, 2019 @10:33PM
(#19292541)
I don't know, I don't write it very much.