Live data from Hacker News

Why F# could be the next mainstream programming language (2024)

blog.snork.dev

51–60 of 99 posts

Re: Why F# could be the next mainstream programming language (2024)

#51
post #47

This feels like "This year is the year of Linux on the Desktop" I've been hearing about F# hitting mainstream for over a decade. Unlike Linux, which is now fairly popular on the Desktop, I predict that F# won't ever be mainstream.

not to get into this debate, but linux is far from mainstream

Re: Why F# could be the next mainstream programming language (2024)

#53

When your top reason for a language being mainstream is "interoperability with .NET", I think the argument is a stretch.

I understand where you're coming from, but I'd challenge your dismissal of that note by noting how seemingly powerful a large ecosystem of available packages is when onboarding people to an ecosystem. I don't think Scala, Kotlin, or Clojure would have had as much adoption if they hadn't had access to the JVM ecosystem of libraries available. While it's not the only benefit, I think one could just point at the usage o…

After reading Paul Biggar's experiences with OCaml when building darklang, and the importance of ecosystem when building distributed systems in the cloud, I don't think I'd ever build a business on a non-hosted functional language.

There are some hefty businesses built on top of OCaml so it definitely can be done, but it sounds too expensive to get a small business up and running if the code itself isn't the product.

So that basically leaves Scala, Clojure and F#

Re: Why F# could be the next mainstream programming language (2024)

#54
post #28

F# is a chimera of a language. The functional parts of the language are nicely designed: no nulls, discriminated unions (ADTs), you write simple functions in simple modules and there is nothing that is too clever to understand: it's very pragmatic. Then there is a whole lot of stuff like inheritance, classes, interfaces, nulls mainly there for dotnet interoperability that gets very ugly very fast. There are way too m…

C# will eventually have unions that will undoubtedly be incompatible too, I worry about source generators becoming ubiquitous as well.

This was also my experience with F#, phenomenal language dragged down by ugly interop with an ecosystem that barely acknowledges its existence and I feel is incompatible with its ideals.

Shame too because there’s some genuinely great stuff in the community like fable [1] where if you were to chuck in JSX like templating you’d have an absolute killer web tool rather than the mess blazor is.

It’s ironic that I found js interop less annoying than .net interop.

[1] https://github.com/fable-compiler/Fable

Re: Why F# could be the next mainstream programming language (2024)

#55

I do not understand how they could develop a language inspired by OCaml but not bring over labeled function arguments. A real L when it comes to ergonomics. And they just have no plans to ever fix this??

> I do not understand how they could develop a language inspired by OCaml but not bring over labeled function arguments. A real L when it comes to ergonomics. Is this what you desire? Named Arguments[0] Arguments for methods can be specified by position in a comma-separated argument list, or they can be passed to a method explicitly by providing the name, followed by an equal sign and the value to be passed in. If sp…

Kinda. Except in OCaml this deficiency does not exist:

> Named arguments are allowed only for methods, not for let-bound functions, function values, or lambda expressions.

Re: Why F# could be the next mainstream programming language (2024)

#56
post #45

Earlier quoted context omitted.

Well there are the 3 you mentioned (records, classes, and tuples) which should be easy enough to differentiate from each other. The struct versions aren't necessary to use in most cases, and are an optimization. The thoughtful, but not breakneck speed of changes within the language is one thing I appreciate a lot. Things do get added (there are proposals and discussions that are fairly regular in the GitHub repo for…

Yeah those examples I gave are not the best. But why records and classes when records can also have methods. What I was getting at was the language looks good until you dive deeper and get into all those rough edges of dotnet interoperability. An example I can think of is functions/methods. I think F# style is to write curried functions (no brackets for function inputs), except class methods are written mostly non cu…

> But why records and classes when records can also have methods.

Records have built in equality logic, Classes don't.

And, because of the interop story, they wanted to be able to define classes.

> C# reified generics and rust like monomorphised generics (with inline keyword) and they used to have two different syntaxes until recently

I almost prefer the old way, where SRTPs required the other syntax. On the other hand I guess between 'inline' and constraints the compiler makes the 'best choice' now...

Also, just minor pedantic comment, both C# and F# will monomorphize for struct of T

Re: Why F# could be the next mainstream programming language (2024)

#57

Earlier quoted context omitted.

Nonsense, .NET is one of the best ecosystems available. Your sentiment is one I tend to hear mostly from people who think it's still .NET Framework and Windows only

Indeed. I read a great write up by Sam Cox of Tracebit[0] on his selection of C# and his focus on productivity nails it on the head. One of the best ORMs, rich standard libraries and first party packages, and has been converging with TypeScript and JavaScript over the last decade[1] while having all of the advantages of runtime type safety. Folks that last looked at C# over a decade ago don't know what they are missi…

The language has also made great strides to increase readability and decrease verbosity. I have been loving a lot of the changes over the years.

Re: Why F# could be the next mainstream programming language (2024)

#58

C# was Microsoft’s response to Java, was F# their response to Scala and Clojure?

F# came out within a 18 months of Scala, It's 'possible' it was a response but my understanding is that many of the folks who created F# were instrumental in adding generics to NET2.0, so it's hard to say for sure.

Re: Why F# could be the next mainstream programming language (2024)

#59

Earlier quoted context omitted.

> I do not understand how they could develop a language inspired by OCaml but not bring over labeled function arguments. A real L when it comes to ergonomics. Is this what you desire? Named Arguments[0] Arguments for methods can be specified by position in a comma-separated argument list, or they can be passed to a method explicitly by providing the name, followed by an equal sign and the value to be passed in. If sp…

Kinda. Except in OCaml this deficiency does not exist: > Named arguments are allowed only for methods, not for let-bound functions, function values, or lambda expressions.

> Kinda. Except in OCaml this deficiency does not exist:

  Named arguments are allowed only for methods, not for 
  let-bound functions, function values, or lambda expressions.
True. They are different languages after all, sharing a common ancestor in ML[0] yet diverging for their own reasons.

Still, the original concern was identified thusly:

>> I do not understand how they could develop a language inspired by OCaml but not bring over labeled function arguments.

0 - https://en.wikipedia.org/wiki/ML_(programming_language)

Re: Why F# could be the next mainstream programming language (2024)

#60
post #28

F# is a chimera of a language. The functional parts of the language are nicely designed: no nulls, discriminated unions (ADTs), you write simple functions in simple modules and there is nothing that is too clever to understand: it's very pragmatic. Then there is a whole lot of stuff like inheritance, classes, interfaces, nulls mainly there for dotnet interoperability that gets very ugly very fast. There are way too m…

> There are way too many variants of the same thing: records, classes, struct records, tuples, struct tuples etc, [...]

> At the end I went with Rust because it has one way of doing such stuff.

I haven't looked at C# in 20 years, but Rust certainly has a LOT of ways to do similar things too:

    struct Foo { x: f64, y: f64 }          // Struct
    struct Foo(f64, f64)                   // Tuple Struct
    let f = (1.0, 2.0)                     // Tuple
    enum U { Foo(f64, f64) }               // Enum Tuple
    enum V { Foo { x: f64, y: f64 } }      // Enum Struct
    [ 1.0, 2.0 ]                           // Size-2 Array
    &[ 1.0, 2.0 ]                          // Slice
    vec![1.0, 2.0]                         // Vec
Then possibly wrapping those in Rc, Arc, Gc, Box, Cow, Option, Result, RefCell, RefMut, Cell, OnceCell, LazyCell, UnsafeCell, Weak, and so on... that's a multiplicative product of possibilities. And you still need raw pointers for interop with C libraries.

Anyways, I haven't used Rust in a few years now either, and I'm sure I've made some mistakes and omissions above, but I don't remember it as the poster child for Python's "There should be one-- and preferably only one --obvious way to do it".

Post reply on HN