"OCaml -- first impressions"

Honestly I doubt Ocaml will ever be truly mainstream, for the following reasons.

A. The community’s, don’t be a pussy, read the source or api docs, and if you’re still stuck ask mentality.

B. Most developers, want magic, so they are more inclined to prefer haskell type classes over modules.

C. It leaves a lot up to the developer, so a lot of build tools, a lot of small libraries.

D. The intended audience for most of the ecosystem, are systems programmers, not application programmers, before anyone tries to dispute this claim, read the package list on OPAM.

E. Popularity of Go, they occupy many of the same spaces, Go is even easier to learn than python, and has a fuckton of libraries, I ended up using Ocaml as a replacement for Go, but most people tend to value ease over simplicity.

Ironically A-D are the major reasons why I love Ocaml.

3 Likes

Thank you, good points.

A. I think people have talked about (maybe even in this thread!) writing more thematic how-to guides. It’s something that needs improvement for sure.

B. Do they? Then why Go?

C. So does JavaScript…

D. True, this is why BuckleScript and Reason are exciting, because they’re attracting app developers.

E. Go perhaps well deserves its popularity, but I think as people keep pushing against harder problems with it they will see the value of an elegant and performant language like OCaml.

4 Likes

I am talking about what most developers seem to seek from functional languages, which is typically (less boiler plate and magic), at least that’s what I wanted coming in when I was like 15.

On Go , honestly yeah I agree I still use Go, mostly for contributing to OS, or short lucrative gigs for blockchain startups, in greenfield projects tho only when the program is pretty much brute force be it network calls, or running commands.

On D, I avoid front end work, but like it is usually not a good thing for application programmers, to flood a systems focused language, like reason could end up being, Ocaml’s elixir.

Elixir is a beautiful language, but well I hate the community more so than that of any other language, why because it’s full of a bunch of people who don’t want to leave the CRUD box, who want to feel special, and don’t bother to learn otp beyond gen_server and spawning procs, like you know the people who brag at work about completing a pattern matching tutorial.

1 Like

Hi @Nobody_Gone, while I appreciate your opinions and I’m sure you have more experience on this than I do, I hope you would refrain from bashing other community, simply because some of us here (myself included) may also be a part of those “bunch of people” and it may trigger unnecessary arguments. Thanks.

7 Likes

Yeah sorry, got angry elixir is kind of my trigger.

2 Likes

There are improvements to be made, obviously. But as you pointed out, some of the difficulties with starting OCaml are also the language’s and community’s charm once you get there.
There are certain popular features and trends which I hope OCaml won’t be swayed much by.

1 Like

Sounds like specific issues with specific people.

I also had frequently issues with a special community, the truth is that a community is often more as a bunch of people, while you had probably issues with a couple of them.

The whole community might be thousand times larger and its fine to feel special :wink:

I confirm most of your impressions.

OCaml is a wonderful language that does less about its marketing, in my humble opinion.

F-Sharp provides a similar indention like Python and is very similar to OCaml otherwise.
OCaml use block building inference on some places :wink:

Reason is another solution, that one provides very neat error messages:
https://reasonml.github.io/community/blog/

They currently work with Bucklescript at OCaml also, native support can follow.

Thanks a lot for your input :sunny:

Does it? As far as I know, OCaml is totally insensitive to whitespace. E.g. you’ll often see code like this:

module StringMap = Map.Make(struct type t = string let compare = compare end)

I personally hope it stays whitespace-insensitive. :slight_smile: This is one of those “there are two kinds of people in the world” issues–ones that like significant whitespace, and ones that don’t. (The advantages of each approach are obvious; no need to discuss them here.)

I sometimes feel that for some parts of OCaml code, there are fewer conventions for code formatting than in some other languages (e.g. Lisp, Java, C), which I don’t like. Or rather, there are too many conventions. (This is a very small dislike, though!) The OCaml Programming Guidelines document, specifies conventions quite clearly, and in some cases there are only one or two legitimate strategies, but there are nevertheless on the order of ten rules for formatting an if/then/else. I’m not saying there’s a better way. I think there are multiple interacting factors that conspire to require flexibility in formatting an if for OCaml. (In some languages, e.g. Clojure or Common Lisp, there are only one or two common ways of fomatting and if expression.) Well, maybe it’s only if formatting that bothers me, but ifs are everywhere.

4 Likes

what i remember from when i started out are these thoughts:

“so i can get close-to-c speed with a well structured high-level language? much better than python!!”

“ok, i have to write +. for floats. weird but i guess this is necessary so that types can be inferred.”

“is this language really alive and big enough so that i can expect sufficient library support and decent tooling?”

the last point was my biggest concern and i think rightly so. anything that points to a lack of manpower in the community, such as old web design, can scare away newcomers who want to get something done soon.

5 Likes

When I started my thoughts were, what the fuck is up with these scoping rules, and wow I am such hipster trash that I find Haskell too mainstream.

Are you aware of ocp-indent? It has become somewhat of a standard in the community, and has led to much more readable code on average.

2 Likes

Yeah, i corrected myself.

I like something subtle for this job.

Parentheses and keywords look both a bit confusing to me, since they add clutter.
Indentation looks like the most invisible to me, next to automagically local scope. ^-^

Thanks a lot ^-^

I remember reading somewhere that the Reason people are working on fixing refmt support for OCaml syntax, so I’m holding out for that :blush:

What is broken on it?

Currently, reformatting loses comments. You can verify with reason-tools, e.g. https://reasonml.github.io/reason-tools/popup.html#KCoqIFJldHVybnMgMSBtb3JlIHRoYW4gdGhlIGlucHV0IGludGVnZXIuICopCmxldCBhZGQxIHggPQogICgqIFdlIGFkZCAxIGhlcmUuICopCiAgeCArIDEK (set it to convert ML -> ML).

2 Likes

And vertical whitespaces! The functions just stack up one another (ML → ML too).

2 Likes

Not a “first impression”, but being stronger in the machine learning side of things would be one way to attract more people.
We need a lot more of machine-learning related packages in opam; like at least bindings to state-of-the art
implementations.
We are weak on this side, while I feel it is a domain where OCaml could shine.
Currently, Python’s scikit learn is packed with cool stuffs in this regard and is the default goto library (and language).

The Owl project is developing ML tools. See e.g. https://github.com/ryanrhymes/owl/wiki/Tutorial:-Neural-Network and https://medium.com/@matriXanger/image-recognition-with-owl-a5a6d0caef33

2 Likes