Live data from Hacker News

F# is gaining independence from .NET

onurgumus.github.io

31–40 of 181 posts

Re: F# is gaining independence from .NET

#31

F# is a great language, but the .NET community never embraced it.

It's a real shame, but not unexpected. The vast majority of programmers I meet in the wild simply do not have training in FP and by the time they decide to learn it (if they do), it's hard to unlearn "traditional" thinking. If we want to steer programming in that direction, we should teach functional programming before "traditional" programming. However, even if we manage to do that I'm not convinced that it will mak…

I've done FP (several years of Erlang), and I use FP daily in my work (since most languages support FP to varying degrees).

I see no point in F# other than "well, it's a nice-ish ML for .NET", and the article does nothing to help with that (file order? really? that's what you're going for as the first point to make about a language?) .

Re: F# is gaining independence from .NET

#32

> In F# the order of the files matter. I didn’t quite understand this section and it seems very counterintuitive can someone elaborate a little?

In an F# project file (and thus also in all editor support), the referenced F# source files have an order. Files can only see types, values etc defined in files above them (and the same within files, with some caveats). This sounds really weird and annoying but turns out to have some surprising benefits (because it limits the mental/real search space for definitions as well). In practice it's just something that is surprising at first, then totally fine.

Re: F# is gaining independence from .NET

#33
Parser combinator libraries written in F# are phenomenal. All these libraries can be used along side C# in a project. Yes, .NET developers haven't embraced F# but I love C# and hate over complicatedness of Haskell so using F# is a pure joy for me.

Re: F# is gaining independence from .NET

#35

> In F# the order of the files matter. I didn’t quite understand this section and it seems very counterintuitive can someone elaborate a little?

I think he means you have to write down a list of files in your project somewhere, but each file can only depend on files that come before it in the list. So the files with the fewest dependencies (e.g. utility type stuff) come first, and `main.fs` (or whatever) comes last.

Re: F# is gaining independence from .NET

#36
post #21

Earlier quoted context omitted.

It's.. not as nice. LINQ gets halfway, but, you end up getting back to procedural modeling soon. With sufficient discipline and structure, and liberal use of LINQ and lambdas, you can mostly get there, but it lacks the purity of pure functional.

And in the process you've incurred a devastating amount of micro-allocations. When using Unity with an older version that doesn't have incremental GC this is a serious problem. Does F# avoid that?

Oh, god no. Performance even on fairly trivial number crunching tasks is half of C#, nevermind anything where GC is important or you'd consider writing it native. It's not a performant language, that's not the point.

Re: F# is gaining independence from .NET

#38
post #21

Earlier quoted context omitted.

And in the process you've incurred a devastating amount of micro-allocations. When using Unity with an older version that doesn't have incremental GC this is a serious problem. Does F# avoid that?

Oh, god no. Performance even on fairly trivial number crunching tasks is half of C#, nevermind anything where GC is important or you'd consider writing it native. It's not a performant language, that's not the point.

That's not a fundamental limitation, though. Implementations of SML (f# is effectively an ML implementation), OCaml, and Haskell are all quite performant.

Re: F# is gaining independence from .NET

#39
Complaining about bad docs isn’t really fair IMHO.

Compared to Swift F# has excellent documentation.

Would be interesting to know what F# is compared with in this case.

Is there a language thats known for excellent docs ?

One thing you can’t pass on when talking about fsharp in the community.

If you have a question just ask on twitter or slack. You’ll get an answer in minutes.

Re: F# is gaining independence from .NET

#40
post #14
post #7

Earlier quoted context omitted.

The functional hammer can be a little easier to reason about. So you can understand your application a little more.

It's possible to write functional C# code, as well.

Ehh, not really. It depends on how you define functional programming. C# supports first class functions, tuples, some form of pattern matching and LINQ extensions support basic FP collection operations like map (Select), filter (Where) and fold (Aggregate). But I think that's just scratching the surface compared to a "real" FP language:

- F# has function composition operators

- F# functions are curried and support automatic partial application

- F# variables and data structures are immutable by default

- F# has powerful global HM type inference

- F# uses option & result monads over exceptions and null

- F# has algebraic data types with exhaustiveness checking

These capabilities make writing code in F# a very different experience from C#. Some of these can be added to C# as features, but many things are fundamental parts of language design that are hard to change afterwards.

Post reply on HN