FAQ
Hi, Why the code works?
https://play.golang.org/p/KlSruIXb2w

package main

import (
"fmt"
         "unicode")

type 𝟩 int64

func (𝟩) 𝟩(𝟩)𝟩 {
return 0x5+0x6
}

func main() {
var 𝟩 = make([]𝟩, 10, 10)
fmt.Println(len(𝟩), cap(𝟩), 𝟩[00:07])
fmt.Println(unicode.IsDigit('𝟩'))
}

In go specs:
An identifier is a sequence of one or more letters and digits. *The first
character in an identifier must be a letter*.
identifier = letter <https://golang.org/ref/spec#letter> { letter
<https://golang.org/ref/spec#letter> | unicode_digit
<https://golang.org/ref/spec#unicode_digit> } .

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Rob Pike at Sep 3, 2015 at 9:23 pm
    Because the compiler doesn't implement the spec; it's lazy. Thanks for
    pointing this out.

    I have filed issue

    https://github.com/golang/go/issues/12483

    Note that go/scanner, go/types and so on do not accept this program.

    -rob

    On Thu, Sep 3, 2015 at 1:25 PM, Runix wrote:

    Hi, Why the code works?
    https://play.golang.org/p/KlSruIXb2w

    package main

    import (
    "fmt"
    "unicode")

    type 𝟩 int64

    func (𝟩) 𝟩(𝟩)𝟩 {
    return 0x5+0x6
    }

    func main() {
    var 𝟩 = make([]𝟩, 10, 10)
    fmt.Println(len(𝟩), cap(𝟩), 𝟩[00:07])
    fmt.Println(unicode.IsDigit('𝟩'))
    }

    In go specs:
    An identifier is a sequence of one or more letters and digits. *The first
    character in an identifier must be a letter*.
    identifier = letter <https://golang.org/ref/spec#letter> { letter
    <https://golang.org/ref/spec#letter> | unicode_digit
    <https://golang.org/ref/spec#unicode_digit> } .

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 3, '15 at 8:25p
activeSep 3, '15 at 9:23p
posts2
users2
websitegolang.org

2 users in discussion

Runix: 1 post Rob Pike: 1 post

People

Translate

site design / logo © 2022 Grokbase