Expand numeric type family #45
Replies: 2 comments 2 replies
-
|
@sprintermax you can post your example here. |
Beta Was this translation helpful? Give feedback.
-
|
Verse already has reserved names for types such as int8, int16 and so on. But currently does not implement them. We can make refinement types and/or type aliases in verse, but it has lots of limitations when comparing to other languages:
And so on... For example, calling any operation such as "Add" with two custom-made int8 is not failable (out of range), and returns normal int back. This makes absurdly annoying to work it, needing to cast back to the correct types and so on every time needed. I've tried other alternatives such as creating dummy classes/structs and storing the values inside, but it also has lots of other downsides, just adding more friction... I have a string related module and I use this a lot on my libraries to constrain and do operations (ex. utf8 character as int8, rune for bigger character ranges and so on), for string manipulation, hashing, binary operations and so on... (verse lacks a native string processing library and we need to do everything from scratch - which is a problem for another discussion) Besides this strings example, there is always the memory topic, when we explicitly want to constrain the memory allocated for that type (for implementation or just efficiency purposes too) I've attached some images related to some of my usages (13MB+ of verse files just for data about unicode implementations for string processing). It is just one example but from time to time I face other roadblocks due to "oh, sadly verse does not support / does not allow that"... This, combining with many other restrictions, including #27, #43 and so on, makes working on libraries and some usages having more friction than it should... |
Beta Was this translation helpful? Give feedback.






Uh oh!
There was an error while loading. Please reload this page.
-
Introduce all remaining int types such as (u)int8 etc.
Together with bit operations this would be great for optimizations and bit masking. Using a big int for every integer value seems like an overkill.
Beta Was this translation helpful? Give feedback.
All reactions