Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is F# case sensitive?

I searched here and on the net but no answer.

The reason I ask is, since F# conventions seems like they favor noncapital letters, using BCL types with Pascal conventions look weird in F#, as in:

let stringD = String.Join(" ",[| stringA; stringB |])

Seems like it would be more in the spirit of F# like this:

let stringD = string.join(" ",[| stringA; stringB |])
like image 753
Joan Venge Avatar asked Sep 17 '10 23:09

Joan Venge


2 Answers

Ok, a few things.

First, F# is case-sensitive.

Second, the F# conventions for naming are described in the F# Component Design Guidelines . Briefly, let-bound members inside F# modules use camelCase, but all .NET OO constructs use PascalCase. This is true throughout the F# library.

Finally, in F# string is not a keyword, rather it is both the name of a type abbreviation (for System.String) and the name of a function (that converts to a string). In the expression context of string.Join, the function name takes precedence, which is why string.Join does not work. And because of case-sensitivity, System.String.join would never work (unless e.g. you added an extension member).

like image 123
Brian Avatar answered Sep 29 '22 11:09

Brian


Yes, F# is case-sensitive

let stringD = string.join(" ",[| stringA; stringB |])

Will not work.

like image 30
Enemy of the State Avatar answered Sep 29 '22 12:09

Enemy of the State