←back to thread

Why F#?

(batsov.com)
447 points bozhidar | 2 comments | | HN request time: 0.44s | source
Show context
pimbrouwers ◴[] No.43546526[source]
Our shop converted 6 years ago, from C# to exclusively F#. I also author and maintain some packages (falco, donald, validus and others). The language is tough to learn if you're coming from a C-style language. But worth the effort and experience. It's extremely concise a true delight to build programs in that are fast, robust and durable.

There are a few drawbacks, depending on your perspective:

- compilation is slower than c# and hot reload isn't supported (it's in progress)

- there are very few opportunities to use it professionally

- hiring devs can be challenging

replies(5): >>43546728 #>>43546760 #>>43548900 #>>43552429 #>>43554801 #
cogman10 ◴[] No.43546728[source]
How does the typing system work for F#?

From the article, it looks like it's mostly dynamically typed. Or is it inferred? Or is it something else?

Like, if I write

    let hello value =
      print value
    
    hello "world"
    hello 2
Does that just work?

To me, that'd be a point that might steer me away from the language. Deducible types seem vital to larger and long lived projects.

replies(2): >>43546825 #>>43546871 #
1. neonsunset ◴[] No.43546825[source]
F# is a statically typed language with gradual typing and full type inference.

Given

  let hello value =
      printfn "%A" value
    
  hello "world"
  hello 2
The binding "hello" has "'a -> unit" signature where 'a is a generic argument it accepts because the "printfn" binding with a given format specifier is generalized the same way and an unconstrained 'T (here 'a) is the most narrow type inferred for "hello".
replies(1): >>43556111 #
2. debugnik ◴[] No.43556111[source]
> with gradual typing

Isn't gradual typing widely understood to mean "gradual between static and dynamic", which F# certainly isn't?