zlacker

[parent] [thread] 2 comments
1. porrid+(OP)[view] [source] 2025-08-22 15:58:02
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.
replies(1): >>throwa+cv
2. throwa+cv[view] [source] 2025-08-22 18:33:55
>>porrid+(OP)
It's also completely insane if youve ever done any scientific work.
replies(1): >>porrid+S03
◧◩
3. porrid+S03[view] [source] [discussion] 2025-08-23 17:47:11
>>throwa+cv
Apart from the extra verbosity, what gives?
[go to top]