In Visual Studio 2015:
let myFunction (``string`` : string) =
"\"Quoted string\"" |> (Regex "\"[^\"]*\"").Match |> string
let myOtherFunction (str : string) =
"\"Quoted string\"" |> (Regex "\"[^\"]*\"").Match |> string
First function generates a compiler error, the string
function is underlined in red. ("This expression was expected to have type Match -> 'a but here has type string")
Second function is fine, no problems.
Is this by design?
The reason is, your parameter and the call at the end are the same thing. Double backticks are used to escape the name, they are not part of the name.
So in your case that means that ``string``
and string
are exactly the same thing, you are trying to pipe into your string parameter. And yes, this is totally by design.
The C# equivalent are @-escaped names, where for example @hello
and hello
would clash.