Search code examples
f#quotations

Why are patterns in Microsoft.FSharp.Quotations.Patterns double quoted?


The active pattern

Microsoft.FSharp.Quotations.Patterns.``|AddressSet|_|``

has its last element double quoted. Why is it double quoted? What is the use of those quotes?


Solution

  • Typically anything surrounded by double backticks (``...``) is just an identifier that otherwise would not be a valid identifier in the language.

    For example, if you want to use a language keyword as a function name (not recommended!) you could escape it in this way. If you didn't use the `` delimiters, this would be a syntax error:

    let ``let`` x = printfn "%i" x
    
    ``let`` 5
    ``let`` 8
    

    So in your case, that statement must be appearing in a context where the active pattern syntax is not recognized as being valid. What is the context in which you see it written this way?