Live data from Hacker News

Why I love OCaml (2023)

mccd.space

251–260 of 313 posts

Re: Why I love OCaml (2023)

#251

Earlier quoted context omitted.

I would suggest that people interested in using OCaml on Windows (or indeed, OCaml at all) try F# instead. It is still an ML-family language. Incidentally, by targeting the CLR, F# is considerably more deployable (both to users and to developers) than OCaml is. Plus, any old NuGet library written in C# or VB.NET can be used almost trivially in F#. This also solves the problem OP listed about a tiny ecosystem, because…

To decide on a language for a math research project, I implemented a toy problem in many languages: What is the distribution of cycle counts for signed permutations on n letters? Use all cores in parallel. C++ 100 19.57s Rust 96 20.40s F# 95 20.52s Nim 75 26.04s Julia 64 30.40s Ocaml 48 41.07s Haskell 41 47.64s Chez 39 49.53s Swift 33 58.46s Lean 7 278.88s Tarjan, n = 10 Nyx - Apple M4 Max - 12 performance and 4 effi…

No Fortran?

Re: Why I love OCaml (2023)

#252
post #96

> why isn’t OCaml more popular I've used OCaml a bit and found various issues with it: * Terrible Windows support. With OCaml 5 it's upgraded to "pretty bad". * The syntax is hard to parse for humans. Often it turns into a word soup, without any helpful punctuation to tell you what things are. It's like reading a book with no paragraphs, capitalisation or punctuation. * The syntax isn't recoverable. Sometimes you can…

+10 for bad windows support, i think this is a key and weirdly underestimated reason just to give an idea how bad, until recently, you could not just go to ocaml.org and download ocaml for windows, you had to either download one for mingw or wsl so for many it was just not installable, i.e. for many we didnt have ocaml for windows, until very very recently

Opam on Windows is a masterpiece of engineering

Re: Why I love OCaml (2023)

#253
post #215
post #184

Earlier quoted context omitted.

> mostly because it's the scripting language of choice for PyTorch and AI-adjacent libraries/tooling/frameworks I would politely disagree. Torch started in Lua, and switched to Python because of its already soaring popularity. Whatever drove Python's growth predates modern AI frameworks

A MAJOR portion of popularity was because of this xkcd comic. https://xkcd.com/353/ It hit the front page of Slashdot, Digg, Reddit, made the rounds on Hacker news, etc... ( https://news.ycombinator.com/item?id=86246 ) Django was also very popular at the time. I had already learned Basic, C++, Java, and C#. I wanted to add a dynamic scripting language that was cross-platform under my belt. A lot of my peers were in t…

I think Python became popular before Go came out.

Do you mean the comic was responsible, or the comic explains why Python is popular? It is definitely the ecosystem. As you said its general purpose. It is used for numerical computing and visualisation, web apps, GUIs, sysadmin. Even a reasonably popular DVCS is written in Python.

Re: Why I love OCaml (2023)

#254
post #249
post #205

Earlier quoted context omitted.

[flagged]

TCL it's almost Lisp with strings instead of atom lists. I prefer it a little over Perl.

No macros, limited support for higher order functions. Its big drawback is the small ecosystem.

I like TCL, but its not really comparable to lisp. Its definitely a great scripting language and is a lot more flexible than it gets credit for.

It got a lot of things right. Event driven concurrency (and its got a good threading model) which is often given as a reason to use JS to right servers. Sandboxing untrusted code. Easy GUIs with Tk. Easy cross platform deployment. Unfortunately it never got traction.

Re: Why I love OCaml (2023)

#256

Earlier quoted context omitted.

The Windows support is bad because OCaml is a PL designed by people who are deep in Linux life. Windows is not something that keeps them up at night. (Which isn't to say they didn't try, just, you know, not as much as it takes) One of the things people often neglect to mention in their love letters to the language (except for Anil Madhavapeddy) is that it actually feels UNIXy. It feels like home.

> designed by people who are deep in Linux life. > it actually feels UNIXy. It feels like home. They use single dashes for long options. This is not home. https://linux.die.net/man/1/ocaml

If that's what you use as your yardstick of what's Unixy, then I guess you don't consider "find" to be Unixy, in spite of being one of the early Programmer's Workbench tools.

Short options were a compromise to deal with the limits of the input hardware at the time. Double dashes were a workaround for the post-dash option car crash traditional Unix tooling allows because teletypes were so slow. There is nothing particularly Unixy about any of these options other than the leading hyphen convention.

OCaml using single hyphens is not un-Unixy.

Re: Why I love OCaml (2023)

#257

Earlier quoted context omitted.

> nowhere near as good as OCaml I'd really like to hear more about this. From what I've used of F# and OCaml, both languages are around 95% the same.

I'll give you my top 3. F# is worse because the type inferencing isn't as good. You need to type annotate in more places. It's a drag, because it feels like a missed opportunity to let the machine do work for you. Additionally, one of the most pleasant and unique features of OCaml, strong named arguments, doesn't exist in F# (except in methods or whatever). Most programming languages don't have this (or it's hamfiste…

interesting. how named arguments work with currying?

Re: Why I love OCaml (2023)

#258
post #96

> why isn’t OCaml more popular I've used OCaml a bit and found various issues with it: * Terrible Windows support. With OCaml 5 it's upgraded to "pretty bad". * The syntax is hard to parse for humans. Often it turns into a word soup, without any helpful punctuation to tell you what things are. It's like reading a book with no paragraphs, capitalisation or punctuation. * The syntax isn't recoverable. Sometimes you can…

I kinda feel that singly linked lists isn't a data structure in FP as much as a (dynamic) control flow structure. It's okay in that application.

Re: Why I love OCaml (2023)

#259

>why isn’t OCaml more popular? OCaml did become popular, but via Rust, which took the best parts of OCaml and made the language more imperative feeling. That's what OCaml was missing!

Ocaml can be as imperative as you need it to be. Or as functional. It has no dogmatic inclination towards functional. It has a very pragmatic approach to mutation.

True, but writing imperative code in OCaml feels quite right. Maybe it's just me, but it always feels significantly clunkier than the functional equivalent. I've had things I've been implementing and though "this works be easier to express imperatively", and almost invariably I've gone and rewritten the code to be functional because of how ungainly the imperative implementation ended up being. It feels a bit too much like somebody embedded a subset of Rexx or Pascal awkwardly into an otherwise perfectly reasonable functional language

Re: Why I love OCaml (2023)

#260
post #215

Earlier quoted context omitted.

A MAJOR portion of popularity was because of this xkcd comic. https://xkcd.com/353/ It hit the front page of Slashdot, Digg, Reddit, made the rounds on Hacker news, etc... ( https://news.ycombinator.com/item?id=86246 ) Django was also very popular at the time. I had already learned Basic, C++, Java, and C#. I wanted to add a dynamic scripting language that was cross-platform under my belt. A lot of my peers were in t…

I think Python became popular before Go came out. Do you mean the comic was responsible, or the comic explains why Python is popular? It is definitely the ecosystem. As you said its general purpose. It is used for numerical computing and visualisation, web apps, GUIs, sysadmin. Even a reasonably popular DVCS is written in Python.

I wrote: “Right as Python was rocketing in popularity, Go came out.”

I wasn’t talking chronology of first release, just describing the overlap in hype cycles back then.

The comic was released in 2007, and started heading to the moon. Go came out around 2009, and almost instantly got traction.

Post reply on HN