|
|
|
|
|
by cogman10
438 days ago
|
|
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. |
|
With regards to your example, the print/printfn (equivalent of Write/WriteLine) functions are a bit funny in F#. They don't actually take bound string values directly. You need to specify the type (which could be a string, a number, obj, etc)
https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...