Using F # in Visual Studio 2012, this code compiles:
let ``foo.bar`` = 5
But this code does not:
type ``foo.bar`` = class end Invalid namespace, module, type or union case name
According to section 3.4 of the F # specification:
Any sequence of characters that is enclosed in double-backtick marks (````), excluding newlines, tabs, and double-backtick pairs themselves, is treated as an identifier. token ident = | ident-text | `` [^ '\n' '\r' '\t']+ | [^ '\n' '\r' '\t'] ``
Section 5 defines the type as:
type := ( type ) type -> type -- function type type * ... * type -- tuple type typar -- variable type long-ident -- named type, such as int long-ident<types> -- named type, such as list<int> long-ident< > -- named type, such as IEnumerable< > type long-ident -- named type, such as int list type[ , ... , ] -- array type type lazy -- lazy type type typar-defns -- type with constraints typar :> type -- variable type with subtype constraint #type -- anonymous type with subtype constraint
... and section 4.2 defines long-ident as:
long-ident := ident '.' ... '.' ident
As far as I can tell by specification, types are called long-idents, and long-idents can be identifiers. Since idents support double inverse letters, it looks like types should also be.
So I misunderstood the specification? Or is it a compiler error?
f # visual-studio-2012
Marty dill
source share