4 ms·
Huh, what about the go spec do you like? To me it always struck me as overly casual and loose compared to other languages, and reads more like a guide.
by EE84M3i 6y ago
Huh, what about the go spec do you like?
To me it always struck me as overly casual and loose compared to other languages, and reads more like a guide.
- yiyus 6y agoAny specific example of where the spec is loose?
- dilap 6y agoPersonally, I've never found the Go spec to be too ambiguous, and it's always answered my questions and in an easy and clear way. I'm a fan! For example, what does the following C# code print? UInt32 x = 1; UInt32 s = x >> 32; Console.WriteLine("" + s); How about the following Go code? var x uint32 = 1 var s uint32 = x >> 32 fmt.Println(s) I can easily answer the question for Go looking at the Go spec, but I cannot seem to find anywhere documented in the C# spec its (more surprising) behavior.
- Someone 6y agoWhat’s missing in https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/expressions#shift-operators https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...? “For the predefined operators, the number of bits to shift is computed as follows: - When the type of x is int or uint, the shift count is given by the low-order five bits of count. In other words, the shift count is computed from count & 0x1F. - When the type of x is long or ulong, the shift count is given by the low-order six bits of count. In other words, the shift count is computed from count & 0x3F.”
- dilap 6y agoNothing, thank you! I must have been looking in the wrong place; I really did try to find it though...