Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up the need for package Interfaces #132

Closed
pat-rogers opened this issue Feb 7, 2017 · 2 comments
Closed

clean up the need for package Interfaces #132

pat-rogers opened this issue Feb 7, 2017 · 2 comments

Comments

@pat-rogers
Copy link
Contributor

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.

@pat-rogers
Copy link
Contributor Author

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...

@pat-rogers pat-rogers reopened this Feb 13, 2017
@pat-rogers
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant