1. 27

Fact #1: according to the go spec, build tools should resolve imports in alphabetical order in order to ensure initialization remains the same.


  2. 18

    I think this one is my favorite.

    #33: go’s compiler is extremely fast, giving you ample time to debug data races and deadlocks.

    1. 8

      A few inaccuracies in this. Having isNaN isn’t go-specific, since NaN == NaN evaluates to false by IEEE794. x != x would work, but it’s IMO less clear than just isNaN.

      go does have an ‘xor’ operator for boolean values – it’s spelled ‘!=’. Although it does lack a ‘^=’ equivalent.

      go does have math.NaN(), but not sure if that’s what she was getting at re. overflowing numeric constants.

      Edit: “Fact #6: in go, integer division is a Euclidean domain, except when the dividend is nonnegative and the divisor is a constant power of two.” seems wrong, too.

      1. 2

        I have no idea what a Euclidean domain is, but I think her statement must be related to the integer arithmetic section of the Go spec:

        If the dividend is non-negative and the divisor is a constant power of 2, the division may be replaced by a right shift, and computing the remainder may be replaced by a bitwise AND operation

        Although I can’t think how that would ever produce anything different from normal division. It’s only negative dividends that pose a problem.

        1. 0

          Yeah, that’s the conclusion I reached, too. She might have gotten confused and thought that the optimization is applied for negative dividends/divisors, too, but I don’t think that’s true.

          Also, technically, fixed-width integers aren’t even a Euclidean domain; she probably just meant having a division and mod operator such that a = (a/b) * b + (a%b), and (a%b) >= 0.

      2. 5

        For every fave this tweet gets, I will give you one #golang fun fact


        Well, let’s see how long this goes.

        1. 4

          Fact #15: if you try to implement a library for recursion schemes in go, rob pike will burn your house down.

          Any body care to elaborate on this? Disclaimer: I know nothing about go.

          1. 12

            Recursion schemes are very general forms of constructing or deconstructing recursive data types. They rely heavily on not only generics but higher-order generics (generics over generics). Rob Pike has repeatedly suggested that generics aren’t worth it for Go and it’s the most constant criticism that arises about the language… so implementing something like recursion schemes swings about as hard as possible in the other direction.

          2. 4

            Fact #16: #golang has its own version of Goto statements, which means someone thought about this for more than two seconds AND STILL DID IT

            I actually used it recently :D

            #31: if you’re tired of pl theory, try pl practice!! Go compiles to its own version of assembly and calls a bespoke assembler (2nd compiler)

            Oh yeah. This is infuriating. The idea is not that bad, but the implementation…

            Actually from the same project as the above link: I’ve noticed that stdlib’s base64 decoding was awfully slow (and it’s a known issue) so I made bindings to a SIMD accelerated library. Well, it currently uses cgo.

            But cgo has overhead so initially I tried to use Go assembly to call the functions. Let’s just say I failed. Currently, because of the stack manipulation mess, but…

            Before I learned that the Go linker can link .syso objects built by a normal assembler, I tried the c2goasm/asm2plan9s hack. It, uh, shoves binary code as constants into a Go assembly file. Which obviously does not work for code that references sections. And one of the instructions I had was mov al, byte ptr [rax + base64_table_enc]. I literally could not figure out how to express that addressing mode (register plus label) in that syntax.

            If there’s one thing AT&T and Intel syntax fans can agree on, it’s that the Go/Plan 9 assembly syntax is a HORRIFIC ABOMINATION.

            1. 5

              There is some value to what she’s saying, but it would be better without the annoying tone. It smells of attention-seeking and it’s the worst part of twitter.

              1. 14

                I wouldn’t say it’s attention-seeking, she’s just not trying to be serious. Which she admits:

                These aren’t even facts anymore I’m just shitposting. But anyway,,,

                1. 2

                  Which begs the question why would anyone think that this is a good fit for lobsters?

                  1. 9

                    Oh I’m not arguing whether it’s fit for Lobsters, I just think attention-seeking is an unfair insult.

                    1. 2

                      should be a good test case for our new “we delete trolls policy ;)

                      For real though it seems pointlessly inflammatory.

                      1. 2

                        Agreed on that, it’s a fun twitter exercise, but not much more then that. Definitely needs a satire tag, at least.

                        1. 1

                          Agreed on that, it’s a fun twitter exercise, but not much more then that. Definitely needs a satire tag, at least.

                          1. 1

                            The first 15-20 or so are relevant facts amusingly phrased. I agree the later points are a lot less good, but those first points make the thread worth posting, to me.

                      2. 2

                        Go does have a good dep tool now, https://github.com/golang/dep.

                        Actually it is probably the best I have ever used. It gives me online fetching + updates AND I can check my dependencies into git.