Search code examples
f#case-insensitivecase-sensitive

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 |])

Solution

  • 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).