← Back to context

Comment by qezz

9 hours ago

I was surprised to see literally invalid names in the "bad" section, e.g. "Cannot start with a digit". Why even presenting this if it's rejected by the compiler?

Author here. The answer is because I mentioned it as one of the bullet pointed hard-rules, and I wanted to include an example to illustrate it.

I wondered if you could sneak in some unicode digit but it seems to reject those too:

    $ go run z.go
    # command-line-arguments
    ./z.go:6:2: identifier cannot begin with digit U+0661 '١'
    ./z.go:7:27: identifier cannot begin with digit U+0661 '١'

(I tried a few of them but not all.)