F # Unicode character units, what is the exact limit?

I am using F # 4.0 / VS-2015

It works great

[<Measure>] type percent let x1 = 100<percent> 

but that would be better

 [<Measure>] type % // Percent let x2 = 100<%> [<Measure>] type € // Euro let cost = 99.99<€> 

Since% is used in F #, any other Unicode characters can be used. Some are allowed and some are not.

The question is, what are the limitations?

Knowing this, for other applications, searching for Unicode characters can be pre-filtered.

allowed

 [<Measure>] type ᚖ // U+1696 [<Measure>] type ᕎ // U+154E [<Measure>] type ඖ // U+0D96 let x3 = 0<ඖ> let x4 = 50<ᕎ> 

is not allowed

 [<Measure>] type (%) // error FS0010: Unexpected prefix operator in type name. Expected infix operator, quote symbol or other token. [<Measure>] type % // error FS0010: Unexpected symbol '{0} in type name [<Measure>] type (﹪) // error FS0010: Unexpected character '﹪' in type name. Expected infix operator, quote symbol or other token. [<Measure>] type ﹪ // error FS0010: Unexpected character '﹪' in type name [<Measure>] type ﹪ // ﹪ U+FE6A [<Measure>] type ٪ // ٪ U+066A [<Measure>] type % // % U+0025 [<Measure>] type % // % U+FF05 [<Measure>] type ‰ // ‰ U+2030 promille [<Measure>] type € // € U+20AC [<Measure>] type ≷ // ≷ U+2277 [<Measure>] type _% 
+5
source share
1 answer

So, if you are immersed in the specification, the type of measure should start with

ident-start- char: letter- char or "_"

where letter-char refers to one of the following Unicode classes:

'\ Lu' '\ Ll' '\ Lt' '\ Lm' '\ Lo' '\ nl'

I really did not check if your characters are in these classes, but I think the general idea is to allow things that look like letters.

+4
source

Source: https://habr.com/ru/post/1243497/


All Articles