4 ms·
Can anyone explain the use of the "·" character?
by marcell 12y ago
Can anyone explain the use of the "·" character?
- hornetblack 12y agoIn go you use '.' for namespace accesses. Eg: os.NewFile. But in C '.' means access struct member. So the · is used instead so to do f = os.NewFile(3, "/dev/zero") # Go you would use f = os·NewFile(3, "/dev/zero"); # C
- markuskobler 12y agoSo Russ Cox goes into more detail in this post https://groups.google.com/d/msg/golang-nuts/MdYlJbW4SAo/TrAEoCjAkMwJ https://groups.google.com/d/msg/golang-nuts/MdYlJbW4SAo/TrAE... Although Go does not compile via C, occasionally C code does need to refer to Go identifiers. Since we chose not to restrict the mangled Go names to the space of valid C names, we must add some mechanism to refer to Go names from C. That mechanism is: 1. In the assemblers and C compilers, which already accepted all non-ASCII Unicode code points in identifiers, the Unicode characters · and / rewrite to ordinary . and / in the object files. 2. A symbol with a leading . has its import path inserted before the . when being linked: inside encoding/json.a, a reference to ".Marshal" is equivalent to "encoding/json.Marshal". Because of 2, we went a long time without needing a special character for slash. Recently the introduction of race detection has made it convenient for package runtime to be able to refer to a few symbols in runtime/race, hence the new slash lookalike."
- 4ad 12y agoSome trivia: In acme or sam (the preferred editors of at least Rob Pike, Russ Cox and Ken Thompson) it is trivial to type a ·. Basically you type ALT . . In fact it's pretty easy to type a whole bunch of Unicode stuff, see keyboard(6): http://plan9.bell-labs.com/magic/man2html/6/keyboard http://plan9.bell-labs.com/magic/man2html/6/keyboard