microsoft / qsharp-language

Official repository for design of the quantum programming language Q# and its core libraries
MIT License
233 stars 54 forks source link

Precedence of lambdas is unclear in the spec #160

Closed k4rtik closed 1 year ago

k4rtik commented 1 year ago

I see that currently it's left as a TODO in the implementation to provide a precedence value for lambda expressions.

But the associated issue is closed with the rationale documented in https://github.com/microsoft/qsharp-compiler/issues/1358#issuecomment-1041086604 that suggests to document it in the spec without specifying lambdas under the operators table of precedence.

It seems the de facto precedence in the reference implementation is in termParser function at https://github.com/microsoft/qsharp-compiler/blob/05098e1a1c077198d28c7313066b6565c1496524/src/QsCompiler/TextProcessor/QsExpressionParsing.fs#L702-L719

I think it will be nice to provide an explicit precedence value for lambdas in the spec as it is currently quite confusing to figure out.