5 ms·
If OCaml gets good tooling and ecosystem I'm totally in. I've heard it's close to Rust but GCed and that sounds extremely enticing.
by nicolashahn 5y ago
If OCaml gets good tooling and ecosystem I'm totally in. I've heard it's close to Rust but GCed and that sounds extremely enticing.
- nestorD 5y agoTooling got me from Ocaml to F#, I would recommend it if that is a criteria for you.
- c54 5y agoI like OCaml a lot but I agree that it suffers from this tooling/ecosystem problem. Even un-fancy languages with good tooling are just going to win, at the end of the day. Go is the main example of this. Rust also has great tooling that's gotten better over time. I think over time Jane Street will (continue to) open source more of its libraries, and hopefully soon will also migrate onto Dune (internally they use jenga[0]). This should mean that the ecosystem within Jane Street more closely matches the external environment and tooling should get better as they push patches upstream. Hopefully. [0] https://discuss.ocaml.org/t/does-jenga-have-more-features-than-dune-is-it-safe-to-assume-that-dune-will-replace-jenga/2578/2 https://discuss.ocaml.org/t/does-jenga-have-more-features-th...
- wk_end 5y agoI mean, maybe. But Core and Async have been open source for a long time, and there's still plenty of people out there using Batteries/Containers/Iter/BOS/Lwt.
- jasone 5y agoI started using OCaml in 2017, and had a rough start. But since then Dune (https://dune.build/ https://dune.build/) and the now-excellent LSP implementation have resolved the biggest issues I had. I haven't had such a pleasant development environment since Turbo Pascal! (To be fair, IntelliJ was also pretty good other than the shortcomings of Java.)
- sideeffffect 5y agoSince you mentioned using IntelliJ, I can't resist asking the question: Have you played with Scala too? If yes, how would you compare OCaml to it?
- frej 5y agoOcaml not unbearably slow when say running 10 simple tests. Ocaml is actually amazingly fast and a pleasure to work with. Sbt is actually worse than dune+opam . Ocaml has type inference globally so you are not required to spray type annotations at everything. But Scala does have type directed lookup (type classes/ implicits). Both have the curse of implementation/typing choices that stops you from doing the actual job ;)
- baby 5y agoIf you start a project today I would really try to use esy (https://esy.sh/ https://esy.sh/) I actually don’t use it myself but it seems to bring the modern programming language experience to OCaml
- devmunchies 5y agoI definitely will use it as my primary server language on side projects after it has a standardized async lib (effect handlers and eio). I was also hoping that rust would be my primary lang but its a little too verbose with all the "<>" for it to be my guilty pleasure. Been dabbling in OCaml since 2018.
- wk_end 5y agoIt's similar to Rust in certain respects, but it feels very different in several others. * There's no ownership tracking. This might be obvious - it doesn't need it, it has GC - but is actually kind of unfortunate; even in GC'd languages, linearity can be used to safely model state machines/typestate or for optimization. * There's no traits/ad-hoc polymorphism at all. * There's no impls, though a common pattern with a similar feel is to define types inside modules with the actual implementation of the type hidden, and provide an interface via functions to create or interact with instances of the type. * It uses exceptions for error handling (when it doesn't use an option type) and even as a lightweight control flow mechanism. And now there's algebraic effects as well. * It has an extraordinarily powerful module system, with functors (pass modules into other modules to produce new modules) and first-class modules (modules that exist as values at run-time that can be passed around to functions). * It has some more advanced type machinery - GADTs, polymorphic variants, and a very interesting, powerful, almost completely unused object system. * This bleeds a little into "ecosystem" and a little into "no ad-hoc polymorphism" and a little into the oddness of the syntax and a little into subjectivity, but in general doing really bog-standard imperative stuff in OCaml, while possible, tends to feel more awkward than it does in Rust.
- edwintorok 5y ago* exceptions for error handling: you can also use the 'result' type (an OK of 'a|Error of 'b type in the stdlib) if you don't like exceptions. At least the function's signatures will give more details in how it can fail and force you to handle the failures (or pass them through to your caller). Unfortunately you lose backtraces that way (though you can use wrappers like reword_error, or logging to give more details on what goes wrong, but backtraces can be convenient in locating the source of an error sometimes). A compromise is to use a wrapper like trap_exn (from Bos) that puts the exception with its backtrace in the Error type and then you propagate that...
- baby 5y ago* There’s no explicit typing also, everything is polymorphic by default * Compiler errors won’t help you much * The tooling is lacking compared to cargo. It’s pretty much makefiles in a lisp language (better love parens) * The ordering of your code matters, shadowing functions and structs is a a thing * use A::* is pretty much the default, and transitive dependencies are imported at the top level, so be ready to be confused about the origin of a function or module or variable I really wish more people would write OCaml so that we’d have a better ecosystem. If you’re looking to get into a new language, you should seriously consider it as there are SO MANY low hanging fruits and opportunities to have an impact on the language.