Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Change nanoflakes to an unsigned 64 bit integer #9

Open
ViniciussSantos opened this issue Jan 17, 2023 · 0 comments
Open

Comments

@ViniciussSantos
Copy link

I believe that changing the nanoflakes spec to use an unsigned 64 bit integer would drastically improve its implementation in a lot of languages, and here are my arguments for it:

  • To correctly implement a nanoflake generator and other auxiliary functions, we heavily depend on bitwise shift operations. The problem is that multiple languages have different ways of dealing with bitwise shift operations on signed integers, especially right shifts. Some languages use aritmetic shifts, some use logical shifts and some use both (you can read more about this in here ). Using an unsigned integer would standardize and simplify implementation because we could always default to logical shifts.
  • It would double the nanoflakes's lifespan.
  • I understand that twitter snowflakes are signed integers, but twitter only has to worry about implementing it in Scala, while we are (hopefully) implementing it in a lot of other languages, so we do have to worry about how to make the spec implementation as consistent as we can across various languages.

I believe that these 3 points are the best arguments I came up with as to why we should change to unsigned 64 bit integers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant