News for hackers. Stuff that matters.
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?
Re:Functional Programming in OCaml by laylomo2 on Saturday March 02, 2019 @10:45PM (#19292581)
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
Re:Functional Programming in OCaml by yawaramin on Saturday March 02, 2019 @10:42PM (#19292575)
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.