Live data from Hacker News

OCaml as my primary language

xvw.lol

211–220 of 296 posts

Re: OCaml as my primary language

#211
post #186

Earlier quoted context omitted.

Java is castrated on purpose on Android as means to sell Kotlin. If that wasn't the case, Google would support Java latest with all features, alongside Kotlin, and let the best win. See how much market update Kotlin has outside Android, when it isn't being pushed and needs to compete against Java vLatest on equal terms.

Blame Oracle. If they had been more forward looking and a bit less greedy, Java vLatest would be the default language on Android.

Not at all, I stand by Oracle on their lawsuit.

Android is Google's J++, which Sun sued and won.

Kotlin is Google's C#.

Plus everyone keeps forgetting Kotlin is a JVM based language, Android Studio and Gradle are implemented in JVM languages, JVM are implemented in a mix of C, C++ and Java (zero Kotlin), Android still uses Java, only that Google only takes out of OpenJDK what they feel like, and currentl that is Java 17 LTS, most of the work on OpenJDK was done by Oracle employees.

Re: OCaml as my primary language

#212

Earlier quoted context omitted.

> aesthetically the double semicolons are an abomination and irk me far more. I think they have been optional for like 20 years, except in the top-level interactive environment to force execution. That being said, I still don't get why people are so much upset with the syntax. You'll integrate it after a week writing OCaml code.

I spent more than a week writing ocaml and still found the syntax pretty annoying. ReasonML would have been nice if the Ocaml community actually cared, but they are a bit insular.

[deleted]

Re: OCaml as my primary language

#213
post #211

Earlier quoted context omitted.

Blame Oracle. If they had been more forward looking and a bit less greedy, Java vLatest would be the default language on Android.

Not at all, I stand by Oracle on their lawsuit. Android is Google's J++, which Sun sued and won. Kotlin is Google's C#. Plus everyone keeps forgetting Kotlin is a JVM based language, Android Studio and Gradle are implemented in JVM languages, JVM are implemented in a mix of C, C++ and Java (zero Kotlin), Android still uses Java, only that Google only takes out of OpenJDK what they feel like, and currentl that is Java…

> Not at all, I stand by Oracle on their lawsuit.

I think it will be very hard for us to find anything in common to agree on then.

Anyway, it’s pretty clear Google is pushing Kotlin because they don’t want to have anything to do with Oracle which has not been cleared by the verdict of their last trial. The situation has nothing to do with anything technical.

Blaming them for pushing Kotlin when the alternative you offer is them using a language they have already been sued for their use of seems extremely misguided to me.

Re: OCaml as my primary language

#214

Earlier quoted context omitted.

Wouldn’t Kotlin be a more reasonable choice in that case? It has ADTs and a lot of the same niceties of Rust.

Yes. It can also be compiled to native. I just think it was held back too much by the java/jvm backwards compatibility but then again that's probably also the justification for its existence. I definitely find it (and jetpack compose) make developing android apps a much better experience than it used to be. What I like a lot about Kotlin are its well written documentation and the trailing lambdas feature. That is def…

> ... the trailing lambdas feature. That is definitely directly OCaml inspired...

Kotlin has a very similar syntax to Groovy, which already had that feature (it looks identical in Groovy and Kotlin)... and I believe Groovy itself took that from Ruby, I believe (Groovy tried to add most convenient features from Python and Ruby). Perhaps that is what came from OCaml?? No idea, but I'd say the chance Kotlin copied Groovy is much higher as JB was using Java and Groovy before Kotlin existed.

Re: OCaml as my primary language

#215
post #148

I saw a talk by someone from Google about their experiences using Rust in the Android team. Two points stuck out: they migrated many projects from Python, so performance can't have been that much of a concern, and in their surveys the features people liked most were basics like pattern matching and ADTs. My conclusion is that for a lot of tasks the benefit from Rust came from ML cicra 1990, not lifetimes etc. I feel…

> I feel if OCaml had got its act together around about 2010 with multicore and a few other annoyances[1] it could have been Rust. No, that wouldn't have made the difference. No-one didn't pick up OCaml because it didn't have multicore or they were annoyed by the semicolons. People don't switch languages because the new language is "old language but better". They switch languages because a) new language does some uni…

I appreciate both OCaml and Rust, but your view seems to be entirely wrong to me, sorry to be blunt.

People wouldn't care much for Rust at all if it didn't offer two things that are an absolute killer feature (that OCaml does not have):

* no GC, while being memory safe.

* high performance on par with C while offering no-cost high level conveniences.

There's no other language to this day that offers anything like that. Rust really is unique in this area, as far as I know.

The fact that it also has a very good package manager and was initially backed by a big, trusted company, Mozzila, while OCaml comes from a Research Lab, also makes this particular race a no-brainer unless you're into Functional Programming (which has never been very popular, no matter the language).

Re: OCaml as my primary language

#216

I saw a talk by someone from Google about their experiences using Rust in the Android team. Two points stuck out: they migrated many projects from Python, so performance can't have been that much of a concern, and in their surveys the features people liked most were basics like pattern matching and ADTs. My conclusion is that for a lot of tasks the benefit from Rust came from ML cicra 1990, not lifetimes etc. I feel…

I agree. If OCaml had solved some of its bigger paper cuts it could have been a real player. Compilation time is much better than Rust too: * OPAM is quite buggy and extremely confusing. * Windows support is very bad. If you ever tried to use Perl on Windows back in the day... it's worse than that. * Documentation is terse to the point of uselessness. * The syntax style is quite hard to mentally parse and also not ve…

I'd say the Modula-2 inspired module system is a very valuable asset compared to today's Rust.

The only contact with OCaml I had was that I wrote a bug report to a university professor because I wanted his tool to process one of my files, but the file was larger than OCaml's int type could handle. That itself wasn't the problem - he wrote it wasn't straight forward to fix it. (This is a bug of the type "couldn't have happened in Common LISP". But I guess even in C one could replace int by FILE_SIYE_TYPE and #define it as unsigned size_t, for instance).

Re: OCaml as my primary language

#217
post #174

Earlier quoted context omitted.

Are you sure about boxed integers? Perhaps you mean floats? As far as I know Ocaml uses the typical integer/pointer divide.

IIRC it has 31-bit integers, which means you can't natively work with 32-bit data without widening.

or 63 bits on 64 bit architectures.

Re: OCaml as my primary language

#218
post #6

I haven't worked in OCaml but I have worked a bit in F# and found it to be a pleasant experience. One thing I am wondering about in the age of LLMs is if we should all take a harder look at functional languages again. My thought is that if FP languages like OCaml / Haskell / etc. let us compress a lot of information into a small amount of text, then that's better for the context window. Possibly we might be able to p…

I have found that Haskell has two good things going for it when it comes to LLM code generation. Both have to do with correctness. The expressive type system catches a lot of mistakes, and the fact that they are compile errors which can be fed right into the LLM again means that incorrect code is caught early. The second is property based testing. With it I have had the LLM generate amazingly efficient, correct code,…

Property-based testing is available in other languages. E.g., JS has fast-check, inspired by quickcheck.

Re: OCaml as my primary language

#219
post #211

Earlier quoted context omitted.

Not at all, I stand by Oracle on their lawsuit. Android is Google's J++, which Sun sued and won. Kotlin is Google's C#. Plus everyone keeps forgetting Kotlin is a JVM based language, Android Studio and Gradle are implemented in JVM languages, JVM are implemented in a mix of C, C++ and Java (zero Kotlin), Android still uses Java, only that Google only takes out of OpenJDK what they feel like, and currentl that is Java…

> Not at all, I stand by Oracle on their lawsuit. I think it will be very hard for us to find anything in common to agree on then. Anyway, it’s pretty clear Google is pushing Kotlin because they don’t want to have anything to do with Oracle which has not been cleared by the verdict of their last trial. The situation has nothing to do with anything technical. Blaming them for pushing Kotlin when the alternative you of…

We don't have to agree in anything, I wasn't asking for any agreement to start with.

I call them dishonest by comparing outdated Java 7 subset with Kotlin, when back in 2017 the latest version was Java 9, and in 2025 it is Java 24, and yet the documentation keeps using Java 8 for most examples on Java versus Kotlin.

How come Google doesn't want to have anything with Oracle, when it is impossible to build an Android distribution without a JVM, again people like yourself keep forgeting OpenJDK is mostly a product from Oracle employees (about 80%) with remaing efforts distributed across Red-Hat(IBM), IBM, Azul, Microsoft and JetBrains (I wonder what those do on Android), Kotlin doesn't build for Android without a JVM implementation, Gradle requires a JVM implementation, Android Studio requires a JVM implementation, Maven Central has JVM libraries,....

If Google doesn't want anything to do with Oracle why aren't they using Dart, created by themselves, instead of a language that is fully dependent on Oracle's kigdom for its own very existence?

Re: OCaml as my primary language

#220

Earlier quoted context omitted.

Funny, I moved to OCaml to sidestep F# tooling. At least last time I used F#: Slow compiler, increasingly C#-only ecosystem, weak and undocumented MSBuild (writing custom tasks would otherwise be nice!), Ionide crashes, Fantomas is unsound... But OCaml sadly can't replace F# for all my use cases. F# does get access to many performance-oriented features that the CLR supports and OCaml simply can't, such as value-types…

Did you try F# in JetBrains Rider? It's the best F# tooling you can buy IMO.

Yes I actually ended up using Rider, although I don't like switching editors. But that only replaces Ionide, and I was having some growing pains with the entire toolchain.
Post reply on HN