Live data from Hacker News

Real World OCaml – 2nd Edition (2021)

dev.realworldocaml.org

31–40 of 82 posts

Re: Real World OCaml – 2nd Edition (2021)

#31

The design of OCaml/Reason is the sweet spot of functional programming for me but every time I must deal with Dune after working with the tooling of Go or Rust I want to stab myself in the face repeatedly and I think that maybe that might just be related to the general concept of "masses" + OCaml.

Dune is a great "window" in my experience with OCaml, it forces you to do more than with every other language but you end up with a better understanding of everything.

Re: Real World OCaml – 2nd Edition (2021)

#32
post #7
post #4

I'm not a huge fan of this book, if I get a book like this I'd expect it to focus on the standard library and not third party libraries. On the other hand it says "real world" OCaml and as far as I can tell that really is how OCaml used so It's hard to blame the author.

The standard library is quite small and not very usable for modern production applications. As an example a lot of the list manipulation functions are not tail-recursive because the tail-recursive implementation is less elegant.

> As an example a lot of the list manipulation functions are not tail-recursive because the tail-recursive implementation is less elegant.

What makes you say this has to do with elegance? This sounds surprising.

Re: Real World OCaml – 2nd Edition (2021)

#33
post #28

Totally unrelated to the link/book, but sparked a question that I've had for a while (curious to hear any answers) --> when you take an initial look at a programming language that you're completely unfamiliar with, and you glance through the syntax of all the basic constructs, do you ever have a particularly strong reaction (be it negative or positive), and if so have you tried to identify why that might be the case?

such a good question! I don't think I've ever had a particularly strong guttural reaction to a language, but I'm definitively biased and either see things that I quite like or dislike in a new language I see.

As I think about why those are I think one of the biggest reasons is familiarity, it's easy to get comfortable doing one thing and it truly sucks to feel like you don't know anything again (I think somebody called this the curse of knowledge? Idk).

Lately I've been intentionally the unknown, or, those languages that I'd look at and be like, "but why!?", for example, why would I want to learn or only use recursion when a for/while has worked for pretty much my whole career? or, following the same functional languages traits, why immutable data? seems like a step backwards?

But the thing is that people, quite likely smarter than me, or at least, a lot more familiar with challenges that I'm not familiar with, came up with solutions that diverge from what I know... and I want to know why! Why they came with immutable data or recursion or a language that pretty much everything is a list (LISP)... and the answers are quite surprising and at the same time I feel that joy of discovery that has almost been erased by years in the industry.

So when you come across a language that you have strong feelings/opinions about, wearing the shoes of the people using it might be quite enlightening and enjoyable.

While I say this, I'm a complete hypocrite because I won't give such courtesy to OOP... but hey, none of us are perfect ;-)

Re: Real World OCaml – 2nd Edition (2021)

#35
post #3

I'm a bit surprised to see this making it to the front page. It's been available for a long time and is one of the first resources anyone with an interest in OCaml is likely to encounter. It seems a little like posting a link to cppreference.com.

I, for one, have the attention span and knowledge organization skills of a Phineas-Gaged goldfish, so it's good to be externally reminded of the existence of good things from time to time.

Re: Real World OCaml – 2nd Edition (2021)

#36

Who would be cruel enough to expose the masses to OCaml?

It was cruel to expose JS to the masses.

I wouldn't mind living in the alternate universe where browsers adopted Ocaml as the built-in scripting language instead of JavaScript.

Re: Real World OCaml – 2nd Edition (2021)

#37

The design of OCaml/Reason is the sweet spot of functional programming for me but every time I must deal with Dune after working with the tooling of Go or Rust I want to stab myself in the face repeatedly and I think that maybe that might just be related to the general concept of "masses" + OCaml.

What's wrong with dune? I thought it was really good.

Re: Real World OCaml – 2nd Edition (2021)

#39
post #24
post #17

An easier introductory book: https://ocaml-book.com/

It was published in 2013, though. Much has changed in terms of tooling, right?

Yes but it is not really relevant for that book. OCaml has an incredible backward compatibility history, and the linked book is about learning the language itself, not its ecosystem.

Things are different for RWO since it relies also on a number of extra tools and libraries which, indeed, change over time (sometimes also substantially)

Re: Real World OCaml – 2nd Edition (2021)

#40
post #29

The design of OCaml/Reason is the sweet spot of functional programming for me but every time I must deal with Dune after working with the tooling of Go or Rust I want to stab myself in the face repeatedly and I think that maybe that might just be related to the general concept of "masses" + OCaml.

Sorry could you explain your comment some more? Genuinely curious what is bad about dune. Just started using it

We can start with that, upon starting down the road to learning a (IMO great) but very, very different syntax than most other languages in OCaml, Dune then asks you to write a lisp file to do basic configuration and I suspect 90%+ people who want to explore just say "fuck it" the second they internalize this.

I'm sure there's a crowd, especially here on HN, that views this as some sort of purity test for the language, but in my opinion it's needlessly obtuse over used by modern build systems.

Then there's the fact that several `init` commands don't actually fully `init` a project (and up until recently, the very example in OCaml's getting started documentation was broken).

Then there's this insanity

    dune build
    dune test
    dune exec # hahaha no, no, this doesn't work.
Then you gotta manually tape together crap between opam and dune (and don't get me started on how insane the lockfile situation is -- I swear to god I complained once and someone told me I should learn to use nix!).

This is all very fun and yak shave-ey and I generally grin and bear it, but boy do I totally get why most people look at me like I'm a weirdo because I like this language.

Post reply on HN