3 ms·
I believe OCaml isn’t as strict about side-effects as Haskell, so if you don’t want the side-effect ceremony Haskell sort of forces on you, OCaml might be a goo
by fiddlerwoaroof 8y ago
I believe OCaml isn’t as strict about side-effects as Haskell, so if you don’t want the side-effect ceremony Haskell sort of forces on you, OCaml might be a good choice. Also, OCaml is strict by default and had a fairly good compiler.
- badfrog 8y agoIs 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."
- JadeNB 8y ago> I believe OCaml isn’t as strict about side-effects as Haskell, so if you don’t want the side-effect ceremony Haskell sort of forces on you, OCaml might be a good choice. Also, OCaml is strict by default and had a fairly good compiler. Probably anyone who's interested here knows, but it may be appropriate to point out that you are using the word 'strict' in two different senses, first in the informal sense of being restrictive, and second in the formal sense of strict evaluation (which is why it makes sense to say that OCaml is less strict, and yet strict by default).
- fiddlerwoaroof 8y agoYeah, I didn't even think about that when I wrote the comment, but it occurred to me later that that might be confusing.