Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Has anyone here built something say, over 10k lines in Ocaml? How is the development experience? IDEs, debuggers, linters, deployment, etc.


I was working on a 30kloc compiler written in OCaml:

- No IDE, I was happily using Vim but many of my coworkers were using Emacs. What helped a lot was Merlin, so I could print the types of the identifiers. This was much more useful than any REPL or IDE I have ever used.

- Debuggers: didn't use much, ocamldebug was an okay experience at best

- Linters: did not use. Most of the LOC were simple enough to just be obvious.

- Deployment: it was a Makefile which took about a minute to build the compiler from scratch. I guess that by using a proper OCaml build system we could've sped things up by requiring less recompilation but it was fine. In the end a binary fell out and could be used however.

I liked the development experience a lot, once it compiled it was reasonably clear that it would work as expected, expanding the compiler was very nice since every time I added a new variant, the compiler complained where I need to add code and then it just worked. We had the advantage that we already had our own mini standard library, so most missing utility functions were already in place when I joined.


> - Linters: did not use. Most of the LOC were simple enough to just be obvious.

I imagine an hlint like linter might be useful, and could give you information about common programming patterns. (Ie hlint tells you when you could be using foldr instead of an explicit recursion.)


I haven't done anything ≥10k lines yet, but I do have a few projects between 1k and 5k lines that I've been working on and I've easily written 50k+ lines of OCaml in the past year. The development experience I've had is probably the best I've dealt with so far. There isn't a ton of infrastructure around the language, but everything that exists feels very high quality.There's no standard IDE really (although I did recently find OCamlEditor, which seems very nice and even runs on Windows!), but Merlin basically turns any compatible text editor into a full-fledged OCaml IDE (with features like quick-checking code, auto completion, linting, and automatic indentation/formatting). Honestly, debugging isn't something I've had to think of very often. The type system does a really good job of rejecting buggy programs, so whenever I write code it usually works as intended immediately (or I've made a small mistake that I'll notice pretty quickly).


There is no IDE. But you can use merlin, which is amazing. Debuggers are not very developed, neither are linters.

For me, the development experience is pretty good. But it takes some time to get used to this new world. Conventions are not the same.


Well, we have an excellent linter, it's called "The OCaml type checker". It even has customizable warnings for your coding style. ;)


I know the Haxe compiler is written in Ocaml, and that's a decent size open source project. I believe Facebook uses it for a number of their programming language related tools too. It seems to gave a sweet spot for writing language parsers and compilers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: