StardustPL / Stardust

"A programming language that doesn't make me angry to use it."
https://StardustPL.GitHub.IO/
The Unlicense
4 stars 0 forks source link

Planning: Primitive type contracts #46

Open LB-- opened 2 years ago

LB-- commented 2 years ago

In the video CppCon 2016: Chandler Carruth “Garbage In, Garbage Out: Arguing about Undefined Behavior...", the presenter at one point brings up the notion of having multiple integer types with the same width and signedness, but different contracts/behavior for things like wrap around and shifting past the end. I am wondering whether this is better handled as distinct types, or as different versions of the primitive operations themselves. For example, two different addition operations, one which does wrap-around and one which doesn't. Then the type wouldn't matter, only the operation.