3 ms·
WUFFS call that type refinement, although you are free to refine much larger types e.g. you can say base.u32[0 ..= 15] and this is a 32-bit unsigned integer...
by tialaramex 5y ago
WUFFS call that type refinement, although you are free to refine much larger types e.g. you can say base.u32[0 ..= 15] and this is a 32-bit unsigned integer... that can't be more than 15.
WUFFS not only refuses overflow (you get a compiler diagnostic) it also infers these refinements from array sizing so as to (at compile time) ensure bounds errors never occur. If you try to index into an array of 426 integers with k, WUFFS will go ahead and refine k to the 0..425 range.
Of course Ada (and presumably your proposal) are for general purpose software, whereas WUFFS is specifically targeted at software for well, Wrangling Untrusted File Formats Safely. So it's fine for some things to be completely impossible in WUFFS (e.g. you cannot write "Hello, World" in WUFFS, because WUFFS intentionally has no idea what a "string" is, or what "console output" is).
- SAI_Peregrinus 5y agoWUFFS calls them that because the formal name for the concept is a Refinement Type[1]. [1] https://en.wikipedia.org/wiki/Refinement_type https://en.wikipedia.org/wiki/Refinement_type