5 ms·
> Although we hear about OCaml less often than other languages, it is still used in many well known places such as ... Microsoft Microsoft's F# language is ess
by brianberns 12y ago
> Although we hear about OCaml less often than other languages, it is still used in many well known places such as ... Microsoft
Microsoft's F# language is essentially a .NET version of OCaml.
- _pmf_ 12y ago> Microsoft's F# language is essentially a .NET version of OCaml. Oh, how I wish there was a JVM variant of F# (no, Scala does not count).
- nandemo 12y ago"Fjord, F# programming language for the JVM." https://github.com/penberg/fjord https://github.com/penberg/fjord It doesn't seem to be in active development, though.
- pjmlp 12y agoNot all features could be supported though.
- profquail 12y agoThe key missing feature -- module functors -- was thought by many to be impossible to represent correctly within the CLR's metadata. I had an idea last year about how they could be implemented within the CLR's type system; the proof-of-concept code is gross, but keep in mind it's only meant to prove that F# could eventually implement module functors: https://github.com/jack-pappas/experimental-functors https://github.com/jack-pappas/experimental-functors
- pjmlp 12y agoI guess you misunderstood me. A few F# features depend on CLR features that JVM does not offer, like value types and reified generics. This will probably change with the planned changes for Java 9+, but until then not everything can be efficiently supported.
- timclark 12y agoScala came at the problem from the wrong direction. F# started with the functional pieces of ML/OCaml and added the 'OO' stuff in record types resulting in a simple and powerful language. Scala seems to have started with the 'OO' stuff and then has kept on adding and adding and adding.
- frowaway001 12y agoThat's ... nonsense? You know what's the defining property of OCaml's OO/module systems? That nobody actually uses it. Compared to that, Scala tries to make all parts of the language work in an orthogonal and consistent fashion. In OCaml, one part of the language is crippled intentionally, due to what seems to be ideological reasons. Apart from that, I'm unsure how OCaml counts as "functional". It doesn't even have typeclasses, let alone higher-kinded types.
- chriswarbo 12y ago> I'm unsure how OCaml counts as "functional". It doesn't even have typeclasses, let alone higher-kinded types. Erm, what? Functional languages are those which implement as much as possible using functions, rather than adding language primitives (eg. if/then/else, looping, mutable state, etc.). If anything, typeclasses make a language less functional, since they're a language primitive which could be implemented with functions instead (by passing records explicitly). Lambda Calculus doesn't have typeclasses or higher-kinded types, does that mean it doesn't count as "functional"? Hell, even Joy is a purely-functional language and it can't even call functions! Type systems are a completely orthogonal concept to functional style; they're a way of embedding a formal logic into a programming language. It just-so-happens that many logics make heavy use of implication (a -> b), and that corresponds to functions. It's possible to give a rich type system to, for example, Prolog or assembly, but the logical operators would be quite unfamiliar.
- lmm 12y agoIn Scala typeclass is not a language primitive, it's just an idiom that can be easily expressed in the language. Whereas programming in the typeclass style with F# is difficult to say the least, basically requiring Greenspunning. "Functional" means many things to many people, but it's the term a lot of people use when talking about the recent rise of languages like Haskell, Scala, F# and OCaml - much of which rise is, IMO, attributable to their type systems. Whatever "it" is that these languages have (and sure, it might be more accurate to talk about "languages providing ADTs and controlled sequencing of effects" or some such), I think it's fair to say that OCaml/F# have less of it in this area, because their type systems don't allow you to express higher-kinded types. F# may have its advantages, but you're definitely missing out on some of the "functional language renaissance" - because whatever the terminology, at least some of that renaissance is about the value of powerful type systems.