Open treiher opened 2 years ago
Declaring an integer type which covers the entire value range can be quite cumbersome:
type T is range 0 .. 2 ** 16 - 1 with Size => 16;
There are many cases in message formats of real world protocols where such integers are required.
Size
type T is range 0 .. 2 ** 16 - 1;
+ No new keyword − Implicit determination of type size could be confusing for user
type T is range <> with Size => 16;
+ No new keyword − range <> does also occur in Ada, but in different context, so could be confusing for Ada programmers
range <>
O3.1
type T is size 16;
+ Concise − New keyword (with the same name as an existing aspect)
O3.2
type T is unsigned 16;
+ Concise + Can be extended by signed keyword for signed integer types − New keyword
signed
type T is mod 2**16;
− Well-known syntax for Ada programmers, but different semantics as in Ada (cf. #727)
Context and Problem Statement
Declaring an integer type which covers the entire value range can be quite cumbersome:
Use Cases
There are many cases in message formats of real world protocols where such integers are required.
Considered Options
O1 Optional
Size
aspect+ No new keyword − Implicit determination of type size could be confusing for user
O2 Box instead value range
+ No new keyword −
range <>
does also occur in Ada, but in different context, so could be confusing for Ada programmersO3 New keyword
O3.1
+ Concise − New keyword (with the same name as an existing aspect)
O3.2
+ Concise + Can be extended by
signed
keyword for signed integer types − New keywordO4 Reuse syntax of modular types
− Well-known syntax for Ada programmers, but different semantics as in Ada (cf. #727)
Decision Outcome
O3.2