5 ms·
I’d also point out, that even in the compiler space, there are basically no production compilers written in Haskell and OCaml. I believe those two languages th
by materielle 1y ago
I’d also point out, that even in the compiler space, there are basically no production compilers written in Haskell and OCaml.
I believe those two languages themselves self-host. So not saying it’s impossible. And I have no clue about the technical merits.
But if you look around programming forums, there’s this ideas that”Ocaml is one of the leading languages for compiler writers”, which seems to be a completely made up statistic.
- pjmlp 1y agoWe must be looking at different compilers.
- runevault 1y agoI don't know that many production compilers are in them, but how much of that is compilers tending towards self hosting once they get far enough along these days? My understanding is early Rust compilers were written in Ocaml, but they transitioned to Rust to self-host.
- beckford 1y agoObviously C is the ultimate compiler of compilers. But I would call Rust, Haxe and Hack production compilers. (As mentioned by sibling, Rust bootstraps itself since its early days. But that doesn't diminish that OCaml was the choice before bootstrapping.)
- pjmlp 1y agoMost C compilers are written in C++ nowadays.
- beckford 1y agoYes, C and C++ have an odd symbiosis. I should have said C/C++.
- deaddodo 1y agoMost C and C++ developers take umbrage with combining them. Since C++11, and especially C++17, the languages have diverged significantly. C is still largely compatible (outside of things like uncasted malloc) since the rules are still largely valid in C++; but both have gained fairly substantial incompatibilities to each other. Writing a pure C++ application today will look nothing like a modern C app. RAII, iterators, templates, object encapsulation, smart pointers, data ownership, etc are entrenched in C++; while C is still raw pointers, no generics (no _Generic doesn’t count), procedural, void* casting, manual malloc/free, etc. I code in both, and enjoy each (generally for different use cases), but certainly they are significantly differing experiences.
- pjmlp 1y agoUnfortunately we still have folks writing C++ in the style of pre-C++98 with no desire to change. It is like adopting Typescript, but the only thing they do is renaming the file extension for better VScode analysis. Another one is C++ "libraries" that are plain C with extern "C" blocks.
- deaddodo 1y agoSure, and we also still have people coding in K&R-style C. Some people are hard to change in their ways, but that doesn't mean the community/ecosystem hasn't moved on. > Another one is C++ "libraries" that are plain C with extern "C" blocks. Sure, and you also see "C Libraries" that are the exact same. I don't usually judge the communities on their exceptions or extremists.
- elbear 1y agoWhat do you define as a production compiler? Two related languages have compilers built in Haskell: PureScript and Elm. Also, Haskell has parsers for all major languages. You can find them on Hackage with the `language-` prefix: language-python, language-rust, language,javascript, etc. https://hackage.haskell.org/packages/browse?terms=language https://hackage.haskell.org/packages/browse?terms=language
- phplovesong 1y agoWhat are you on? Rust was written in ocaml, and Haxe is still after 25 years going strong with a ocaml based compiler, and is very much production grade.
- deleted 1y ago[deleted]