You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the way the HAL package declares some of the unsigned types, clients need both the HAL package and the Interfaces package because the HAL package alone doesn't make the operations available.
Specifically, the HAL package declares some types as subtypes of those in Interfaces. That makes the subtype name visible via HAL, but not the operations. There is no transitivity of visibility for the operations, in other words.
Currently the HAL package does this:
type Bit is mod 2**1
with Size => 1;
...
subtype UInt8 is Interfaces.Unsigned_8;
subtype Byte is Interfaces.Unsigned_8;
...
subtype UInt16 is Interfaces.Unsigned_16;
...
subtype UInt32 is Interfaces.Unsigned_32;
...
subtype UInt64 is Interfaces.Unsigned_64;
Instead of subtypes, we should derive them, thereby inheriting the operations too. That would make package HAL sufficient by itself. Thus, for those defined as subtypes of Interfaces.*, we would just do this:
...
type UInt8 is new Interfaces.Unsigned_8;
subtype Byte is UInt8;
...
type UInt16 is new Interfaces.Unsigned_16;
...
type UInt32 is new Interfaces.Unsigned_32;
...
type UInt64 is new Interfaces.Unsigned_64;
That will make the operators available for the new types, solely with package HAL, and thus clients will not need with/use-clauses for Interfaces in their code. It will also make the shift and rotate operations available.
The text was updated successfully, but these errors were encountered:
Unfortunately we don't use the HAL alone for the types. There is use of package Interfaces throughout, including for the signed integer types, so this proposal would not be a complete solution. We still have to change client code...
We still have to change client code... but I don't see any way around that. I do believe the proposal is the simplest way to get rid of the need for both the HAL and the Interfaces packages in client code.
With the way the HAL package declares some of the unsigned types, clients need both the HAL package and the Interfaces package because the HAL package alone doesn't make the operations available.
Specifically, the HAL package declares some types as subtypes of those in Interfaces. That makes the subtype name visible via HAL, but not the operations. There is no transitivity of visibility for the operations, in other words.
Currently the HAL package does this:
type Bit is mod 2**1
with Size => 1;
...
subtype UInt8 is Interfaces.Unsigned_8;
subtype Byte is Interfaces.Unsigned_8;
...
subtype UInt16 is Interfaces.Unsigned_16;
...
subtype UInt32 is Interfaces.Unsigned_32;
...
subtype UInt64 is Interfaces.Unsigned_64;
Instead of subtypes, we should derive them, thereby inheriting the operations too. That would make package HAL sufficient by itself. Thus, for those defined as subtypes of Interfaces.*, we would just do this:
...
type UInt8 is new Interfaces.Unsigned_8;
subtype Byte is UInt8;
...
type UInt16 is new Interfaces.Unsigned_16;
...
type UInt32 is new Interfaces.Unsigned_32;
...
type UInt64 is new Interfaces.Unsigned_64;
That will make the operators available for the new types, solely with package HAL, and thus clients will not need with/use-clauses for Interfaces in their code. It will also make the shift and rotate operations available.
The text was updated successfully, but these errors were encountered: