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.
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.
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.
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.
#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.
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.
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.
I think this one is my favorite.
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.
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:
Although I can’t think how that would ever produce anything different from normal division. It’s only negative dividends that pose a problem.
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.
For every fave this tweet gets, I will give you one #golang fun fact
Well, let’s see how long this goes.
Any body care to elaborate on this? Disclaimer: I know nothing about go.
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.
I actually used it recently :D
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
.sysoobjects 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 wasmov 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.
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.
I wouldn’t say it’s attention-seeking, she’s just not trying to be serious. Which she admits:
Which begs the question why would anyone think that this is a good fit for lobsters?
Oh I’m not arguing whether it’s fit for Lobsters, I just think attention-seeking is an unfair insult.
should be a good test case for our new “we delete trolls policy ;)
For real though it seems pointlessly inflammatory.
Agreed on that, it’s a fun twitter exercise, but not much more then that. Definitely needs a satire tag, at least.
Agreed on that, it’s a fun twitter exercise, but not much more then that. Definitely needs a satire tag, at least.
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.
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.