News for hackers. Stuff that matters.
Re:Go 1.13 Release Notes by derefr on Tuesday September 03, 2019 @03:06PM (#20869982)
Compile-time integer exponentiation in Go would be neat, e.g. 5 * (1000**4).

I know we have scientific-notation integer literals, but it's not the same thing, especially when trying to calculate e.g. Mebibytes.

Re:Go 1.13 Release Notes by pkaye on Tuesday September 03, 2019 @03:18PM (#20870110)
In go you can use scientific notation for integers

   var x int = 1e9
Re:Go 1.13 Release Notes by Cthulhu_ on Wednesday September 04, 2019 @05:11AM (#20875335)
You say that, but I find that a lot harder to read (and using `e` notation) than just the number - and readability / clarity is more important than cleverness, especially in Go.

10_000_000 can be read, 5 * (1000**4) and 1e7 has to be decoded. By me anyway, I'm just an average developer that never did well in maths - and you have to write code for the average developer, not for yourself and not for the top 10% smartest people.

Re:Go 1.13 Release Notes by big_chungus on Tuesday September 03, 2019 @03:35PM (#20870289)
Not sure about go, but you can do this in C as a compile-time constant:

  #define foo 1.34E8
Maybe go would benefit from a pre-processor? Though it can be somewhat byzantine in C (and result in very unpredictable final source, if abused), it's very helpful to have a complete functional language available for code transformation. It might help go in some cases, too.