Hacker News new | ask | show | jobs
by avsm 4473 days ago
> This might be entirely superficial of me, but I always preferred Haskell over OCaml simply because OCaml required me to type ";;" after every line.

That's easily fixed: only the toplevel requires ;; (to commence evaluation of the phrases you've typed in). Just don't use it in normal code and everything will parse fine.

1 comments

> everything will parse fine.

That's an exaggeration. There are circumstances in files where it's necessary. I didn't realize this, which hung me up for a long time.

Would you care to share an example? I've never encountered a justifiable need to write ;; outside the REPL. The only uses of ;; I've encountered "in the wild" were hardly reasonable: essentially top-level code that was not wrapped in a "let () = ..." statement.
I don't recall seeing that recommendation before this thread. That may just be my blindness in skimming things too quickly. In any case, I think it indicates a wart in the language when you have to wrap everything in otherwise useless let blocks just to get it to parse.
Don't put non-let expressions at the top level?