Re:Go is still not good
by porridgeraisin on Friday August 22, 2025 @11:58AM
(#44986133)
That is consistent though. Constants take type based on context, so 8 * time.Hour has 8 as a time.Duration.
If you have an int variable hours := 8, you have to cast it before multiplying.
This is also true for simple int and float operations.
f := 2.0
3 * f
is valid, but x := 3 would need float64(x)*f to be valid. Same is true for addition etc.
Re:Go is still not good
by throwawaymaths on Friday August 22, 2025 @02:33PM
(#44988067)
It's also completely insane if youve ever done any scientific work.
Re:Go is still not good
by porridgeraisin on Saturday August 23, 2025 @01:47PM
(#44997719)
Apart from the extra verbosity, what gives?
In Go, `int * Duration = error`, but `Duration * Duration = Duration`!