5 ms·
They're barely used in industry.
by nnoitra 4y ago
They're barely used in industry.
- gpderetta 4y agoI wonder why this is the case. Ocaml syntax doesn't seem very arcane, it is not hell-bent on functional purism and pragmatically allows for imperative code. Performance seems quite reasonable. What does it lack that prevented it from gaining wider acceptance? Surely buy-in from a large company was an issue, but even F# hasn't seen any significant uptake. Is it really the lack of curly brackets? That didn't stop Python... Is it just that being labelled 'functional' was a huge stigma for a very long time?
- dgan 4y agoLibraries!!! Python is "batteries included" while OCaml barely has insulation around electrical wires. EDIT: okey that actually maight be a chicken-egg reasonning
- WastingMyTime89 4y agoIf Ocaml had been designed in the USA it would have been widely successful. It’s main drawback was being mostly a French project.
- usrnm 4y ago> If Ocaml had been designed in the USA it would have been widely successful I doubt that. There are plenty of American SML dialects and F# is about as American as it gets, but neither of these languages saw any commercial success.
- kragen 4y agoThe syntax is not great, the standard library is very sparse, and the error messages from the compiler and interpreter are terrible (and used to be worse). The OCaml team used to treat the native code compiler (ocamlopt) as a second-class citizen, but it's the implementation that matters for performance. Since the end of Dennard scaling about 15 years ago, OCaml's lack of multithreading has also been a pain point, one which is finally starting to improve in the last year or two. I don't think being labeled "functional" was ever a huge stigma. Being labeled "Haskell" is a huge stigma in some circles, but OCaml's never been labeled "Haskell". Until about 10 years ago functional programming didn't become popular enough to have any kind of popular opinion, positive or negative, and the people who knew about it generally thought it would be nice to do more of it. Mostly I think people use a programming language either because they already know it or it's the scripting language for an environment they have to use. Assembly was the scripting language for your CPU, especially in mainframe days. BASIC was the scripting language for personal computers. Visual Basic was the scripting language for WIMPs. VBA was the scripting language for Excel and Word (previously Excel had a table-based macro thing). sh was the scripting language for the Unix filesystem; C was the scripting language for the Unix system call interface, and a nice upgrade from assembly. JS was and is the scripting language for the browser. Lua is the scripting language for WoW, Roblox, and Minetest. Perl was the scripting language of the WWW, then PHP was, or Ruby if what you really want to script is Rails. SQL is the scripting language for your database. Objective-C was the scripting language for NeXTStep; now Swift is. MATLAB was the scripting language for EISPACK and later *PACK and BLAS, though it had some competition from IDL for a while. Now Python is the scripting language for Numpy (and thus BLAS), Matplotlib, and TensorFlow. Only a few popular languages are exceptions to this rule: Fortran, COBOL, C++, Java, R, Pascal, Golang, and C#. OCaml? OCaml is the scripting language of ocamlyacc and Coq. If you write OCaml then it's probably because you like Coq. This may have been a public relations problem in the Anglosphere, especially before same-sex marriage.
- wawjgreen 4y ago
- octachron 4y agoWhy do you think that the native compiler was treated as a second class citizen? This is quite strange take from my point of view. For instance OCaml native compiler was available on the M1 Macs two months after the M1 release. Similarly, all major CPU architectures (x86, ARM, PowerPC, RISC-V, s390x) have been supported for years.
- kragen 4y ago20 and 25 years ago, the attitude (as I remember it) was that the native-code compiler was not very important because the bytecode interpreter was fast enough for most uses. It's true that that is no longer the attitude. But if we want to understand why one language is more popular than another, we usually need to look at things that happened in the past, not just things that are happening right now. Even C's meteoric rise took 15 years from the first C compilers until it was the undisputed queen of programming languages, partly as a result of missteps made by the communities of ALGOL-68, ALGOL-W, Lisp, PL/I, SNOBOL, TRAC, FORTRAN, BCPL, and, perhaps most interestingly, MULTICS, 20 years earlier. (It's also possible that my memory that the OCaml team treated the native-code compiler as a second-class citizen is incorrect, either because I misremember what they were saying or because I misinterpreted it.)
- octachron 4y agoAh yes, it might be possible that during the time of Caml light, the bytecode compiler was for a time considered to be fast enough. I am not sure that a ephemeral stance from 25 years ago on an ancestor language still really matters nowadays.
- kragen 4y agoI'm not talking about Caml Light or even Caml Special Light, which is when the native-code compiler was initially added. 25 years ago was 01997. Objective Caml was released in 01996 (and renamed OCaml in 02011). Projects like KDE, the GIMP, GNOME, Lucene, Jython, LLVM, Asterisk, Audacity, CMake, and Danger that got started in C, C++, or Java in the 01997–02002 period are still based on those languages today. OCaml would have been a reasonable language for all of these, though a new interpreter for Python in OCaml would have lacked Jython's key feature, the ability to easily script other things written in Java. (Danger? Well, Danger as such ended in 02011, but Andy Rubin founded Danger in 01999 and left to found Android in 02003, which ended up making a Java-based smartphone much like Danger's Java-based smartphone, but less locked down.) The fact that Java focused heavily on performance starting in 01997, when Sun bought Animorphic, meant that a lot of things were able to be written in Java in the 02000s, things that were previously just unthinkable. Lucene predates HotSpot by a bit, but the whole Hadoop ecosystem that grew out of it only makes sense in a HotSpot world. Minecraft obviously pushes performance heavily. SPARK is written in Scala, but OCaml would have been a good fit too—if Hadoop had gone that direction.
- chii 4y agoIt's not that there's stigma, but that it is probably more difficult to think functionally when most programming education teaches imperative methods.
- asplake 4y agoBut look at their influence: TypeScript and Rust, not to mention Elm, PureScript and other less mainstream languages
- tgv 4y agoTypeScript is very much a C++ descedant, IMO.
- darksaints 4y ago+ Scala
- marginalia_nu 4y agoEven if functional programming itself isn't used, a lot of its patterns are extremely useful even outside of functional programming. Code returning side effects rather than having side effects, for example, is great, and I find myself returning to the principle in a lot of the stuff I design as an architectural principle.