timotheecour / Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).
http://nim-lang.org/
Other
2 stars 0 forks source link

`type TimeUnit = distinct int128` #762

Open timotheecour opened 3 years ago

timotheecour commented 3 years ago

(placeholder, will add more details)

notes

links

libs

https://github.com/status-im/nim-stint/blob/master/stint.nim has multiprecision library, including a Int128, so this is a candidate thing to compare against

func i128*(n: SomeInteger): Int128 {.inline.} = n.stint(128)
func i128*(s: string): Int128 {.inline.} = s.parse(Int128)
juancarlospaco commented 3 years ago

Some day the int128 should be moved into public API, with its features and limitations documented, I do not see a reason to not do it, theres already more "unsafe" stuff in public APIs anyway...

timotheecour commented 3 years ago

it's not about "unsafe", it's about the added complexity, here are the challenges i see:

I'm still very much in favor of adding int128, but it will require some work

juancarlospaco commented 3 years ago
timotheecour commented 3 years ago

=> filed https://github.com/nim-lang/RFCs/issues/399