4 ms·
Depends what is your goal. Learning a language with decent type system? Learning a language with lower level access to operating system features? I would sugges
by StreamBright 9y ago
Depends what is your goal. Learning a language with decent type system? Learning a language with lower level access to operating system features? I would suggest to learn OCaml because it got really popular in 2017 thanks to Facebook & Bloomberg, it has an amazing type system and you can use it to build CLI tools and web pages (Reason/Bucklescript) with an insanely good tooling (utop, jbuilder, merlin) and the community is probably the best community of software engineers I have encountered recently. If you are interested in lower level coding there is Mirage as well.
https://discuss.ocaml.org/ https://discuss.ocaml.org/
- papaf 9y agoI used OCaml a few years ago and I thought it was an excellent language. Despite being powerful it was really easy to learn. One thing that put me off in the end was that it didn't support native OS threads (I have the same problem with Racket). Has threading support improved over the years?
- grayrest 9y ago> Has threading support improved over the years? The main push in this area is Multicore OCaml[1]. I don't track OCaml closely enough to know how getting this into the main compiler is going. [1] https://github.com/ocamllabs/ocaml-multicore/wiki https://github.com/ocamllabs/ocaml-multicore/wiki
- StreamBright 9y agoI am not sure what exactly you are missing, isn't this a native OS thread either POSIX or Win32? http://caml.inria.fr/pub/docs/manual-ocaml/libref/Thread.html http://caml.inria.fr/pub/docs/manual-ocaml/libref/Thread.htm...
- papaf 9y agoThe documentation that you linked to is not describing native OS threads. I am sure that the OCaml implementation is good for a lot of applications. However, because I am used to writing multithreaded code using pthread or std::thread, I find the standard OCaml model uncomfortable and limiting. Its mostly a matter of personal taste but this is the reason I stopped using OCaml.
- masoodusmani 9y agoAre you sure Racket doesn't support native threads? I thought it had something called "places" for that.
- papaf 9y agoI did not know about places, but after reading about them [1], I can see that although they are implemented on top of OS threads, it is not a conventional threading model. For instance there is an instance of the Racket VM per place and this makes them heavier than it would be in a standard system programming language language such as C, C++ or Rust. I am not saying it is better or worse -- just different. [1] https://www.cs.utah.edu/plt/publications/dls11-tsffd.pdf https://www.cs.utah.edu/plt/publications/dls11-tsffd.pdf
- seertaak 9y agoI tried it too; after I realized I that every struct had to have unique field names, I gave up. This was too much craziness for me, although I did think the module/functor concepts were very cool.
- ernst_klim 9y ago>I that every struct had to have unique field names Nope, different structs could have fields named the same.
- z0ltan 9y agoI have always been interested in OCaml, but I have a genuine question though - last when I looked at seriously at it, the standard library seemed to be a bit of a mess lacking a lot of features. A lot of modern resources seemed to focus on using Jane Street's Core(?) which I would not like to use - I'd rather depend on the standard language for standard features. Is this still a thing, or am I mistaken, or both? Please help! I really would like to use OCaml for a variety of hobby projects, including toy compilers. Which books/resources would you recommend?
- erk__ 9y agoYou could also take a look at F# wich is also a ML derived language so the syntax is very similar to OCaml.
- z0ltan 9y agoI did consider it seriously (especially after watching Scott Wlaschin's Parser Combinators video), but it seems a bit too MS-centric for my liking. Who knows, maybe if learning OCaml doesn't pan out that well, it might be F# for me! :D ... the community seems to be focused, so that's one big advantage.
- xfer 9y agoYou don't need Core, the shipped stdlib is good enough for toy projects. There are other stdlibs like containers and janestreet has split their stdlib into smaller pieces. What's your issue with having to use alternate stdlibs? Regarding books, Real World Ocaml is very well written, although some examples might need tweaking.
- z0ltan 9y agoThanks for the reply! Mostly wondering how people ship stuff if there are different variants of std libs? Say you write your code entirely using one std lib and then try to share it (the code that is) with somebody who uses a different std lib, then the onus of learning the new std lib is entirely on him, right? How does that work for teams then? I know that Jane Street is a big user and so they have considerable influence. That being said, does the std lib (the one bundled with the distro) have enough features (like all the necessary data structures, for instance) to make using it viable in a non-trivial project (off the top of my head, say writing a very simple web server)? If so then, I suppose that's good enough. Any recommendations for learning material? I have a copy of "Practical OCaml", don't really like it. INRIA's materials seem quite substantial, but more like reference.