Replies: 8 comments
-
Why does this struct need any such constraints? You're not performing any specialized arithmetic operations. Also, DateTime wouldn't qualify as numeric, literal or primitive. |
Beta Was this translation helpful? Give feedback.
-
A range means a sequnce of continuous values. It implies arithmetic increment, which applies to numeric, date and char types.
|
Beta Was this translation helpful? Give feedback.
-
besides, I needed this in the In-Range Data Types proposal #1198 . |
Beta Was this translation helpful? Give feedback.
-
@MohammadHamdyGhanem
A range implies comparability between values, nothing more. The potential continuous nature and lack of any universal unit makes arithmetic incrementing impossible.
A |
Beta Was this translation helpful? Give feedback.
-
I'll note that a |
Beta Was this translation helpful? Give feedback.
-
There is a deeference. The you can rename my range as ConstrainedNumeric. If the can add a Value property to the Range Class, then both ideas can be combined togather, but my ConstrainedNumeric is lightweight structure sutable for basic data types. |
Beta Was this translation helpful? Give feedback.
-
@MohammadHamdyGhanem you'll need shapes for the constraints you want. |
Beta Was this translation helpful? Give feedback.
-
@HaloFour , @orthoxerox |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was writing this struct:
I want to use this range to deal with basic numeric data types and dates. Why there is no keywords for:
These basic types have common behavior, but they have't a base class or interface.
Beta Was this translation helpful? Give feedback.
All reactions