I am trying to write F# parser. According to the specification the let expression looks like:

let value-defn in expr

I am using Try F# for testing. I tried following code which is parsed without error.

#light "off"
let a = 1

Yet according to the manual, should always contain in keyword. Why is it valid F# code?

有帮助吗?

解决方案

This is actually covered by another part of the spec (A.2.1.1)

module-function-or-value-defn :

  attributesopt let function-defn

  attributesopt let value-defn

Since you are defining something in a module directly, it doesn't need the in

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top