Improvements to Ocaml Code Editing: the Basics of a Refactor Engine
Posted5 months agoActive4 months ago
tarides.comTechstory
excitedpositive
Debate
20/100
OcamlRefactoring ToolsCode EditingProgramming Languages
Key topics
Ocaml
Refactoring Tools
Code Editing
Programming Languages
The article discusses improvements to OCaml code editing with the development of a refactor engine, sparking discussion on the potential for advanced refactoring capabilities and better IDE integration.
Snapshot generated from the HN discussion
Discussion Activity
Moderate engagementFirst comment
27m
Peak period
7
1-2h
Avg / period
2.4
Comment distribution17 data points
Loading chart...
Based on 17 loaded comments
Key moments
- 01Story posted
Aug 20, 2025 at 9:37 AM EDT
5 months ago
Step 01 - 02First comment
Aug 20, 2025 at 10:04 AM EDT
27m after posting
Step 02 - 03Peak activity
7 comments in 1-2h
Hottest window of the conversation
Step 03 - 04Latest activity
Aug 20, 2025 at 8:41 PM EDT
4 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 44961847Type: storyLast synced: 11/20/2025, 3:38:03 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Does it replace identical expressions in the same scope? Like:
becomes ?EDIT: Or even crazier with function:
becomes (I ask this just out of curiosity. Even the "simpler" version is very impressive!)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!
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.
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.
1 more comments available on Hacker News