Repository navigation
Add specification for range types - #1181
Conversation
|
Read through the spec. It makes sense to me. |
|
Thanks, Michael! I realized I still need to specify the default value for a range type. I think the spec can be as follows:
Also, I think the second requirement for a valid range type can be simplified to say "the default value must be valid for the type." |
To stay within the range of the base type, it should be: (1) the lower bound if (a) that's valid or (b) the lower bound is the max value of the base type; otherwise (2) the lower bound plus one. This rule should always produce a value of the base type that is valid for the range if and only if the range has any valid values. @Kronos3 It turns out I did have to work out this algorithm in the spec, as you were suggesting yesterday. I realized this as I started to implement the ranges on the C++ side, and I needed static checks for these things. |
This specification addresses #980 and #102. I decided to fold in #102 because it is closely related: since we are checking user-specified ranges, we should also check the ranges provided by the basic numeric types.
I updated the
everyexpression for the throttle specifier to use a range type for microseconds.