Only thing that would go on my OCD nerve, is the lack of an empty newline when the show_markup function is extracted. Kind of "common sense" when writing top level bindings to leave some breathing room between them.
For the second point we delay the aeration convention to the formatter (ocamlformat). It can be configure in a different way :)
Thanks for your feedback!
Does it replace identical expressions in the same scope? Like:
let tau = 3.14 +. 3.14
becomes let pi = 3.14
let tau = pi +. pi
?EDIT: Or even crazier with function:
let _ = (x + 1) + (y + 1)
becomes let plus_one a = a + 1
let _ = (plus_one x) + (plus_one y)
(I ask this just out of curiosity. Even the "simpler" version is very impressive!) let tau =
let pi = 3.14 in
pi + pi
if we extract `pi + pi` it will lead (if you do not give any concrete name) to the following code: let fun_name1 pi =
pi + pi
let tau =
let pi = 3.14 in
fun_name1 pi
The most recent one I’ve made runs 'git grep' on the word under cursor or on the visual selection and puts everything into a quick fix list.
Since it is generic, it works on any phrases as well, and helps me find prose snippets and phrases in docs or other writings.
However, I (as maintainer of OCaml-eglot) find Emacs easier to extend (the VSCode extension is surprisingly complex when you stray from the beaten path), which seemed perfect for incubating an experimental feature. Furthermore, as mentioned at the end of the article, the feature can also be invoked from a code action, which makes it de facto callable from VSCode once the various PRs have been merged :)
Here significant work was done to properly bridge the gap between Merlin and the LSP server so it should work fine in VSCode.
Generally speaking, the Ocaml community seems to spend a lot of time getting VSCode to work.
"Examples of functional programming languages include OCaml, Erlang, Clojure, Haskell, Scala, and Common Lisp."
F# and OCaml are close cousins, and for me F# is even cleaner syntax and twice as fast (M4 Mac Studio).
It was a struggle for me to overcome my partisan preference for OCaml.
F# have drifted a bit further since but not that much. It’s a nice language but it’s not really comparable to Ocaml at this point. At least, I don’t see many cases where people would have to chose one or the other. I think people know if they want the CLR or not.
I'm escaping the black hole of Haskell. If one can code in Chez Scheme, one can code without parametrized modules, as much as I admire them. And there are also F# additions OCaml could admire.
I held back for all of your reasons, and finally caved. I never saw myself in the .NET ecosystem, but prejudices are a funny thing.
I don’t think people have prejudices here. Ocaml is Ocaml and F# is F#.
If your point is that people using OCaml should instead use F#, I vehemently disagree. That would be losing most of what makes Ocaml actually Ocaml.
Still F# is a nice language. F# without using .Net library I don’t see the point however. It’s the most interesting part of the language.