Reputation: 497
I learned that there is a public part and a private part in an Ada specification file (*.ads) and only the public part should be considered of the user of the compilation unit (usually a package).
It is actually not usual to separate the public and private part of the specification in different files?
So, finally, the user of such a package knows about the internals of the packages on specification layer but can not use it. Am I right here?
Thanks and cheers, Wolfgang
Upvotes: 2
Views: 226
Reputation: 6611
No, Ada does not allow you to separate the public and private part of a package specification.
The original chief designer of Ada, Jean Ichbiah, did some work on a language, which actually separated the public, private (data structure) and implementation parts of a package, but this didn't become a part of Ada.
Also:
... so you can't always just ignore the private part of a package specification completely.
A practical example:
When I write unit-tests, I like to put the test suite in a child package of the package I am testing. That way my test cases are not limited to inspect the public view of the types declared in the package.
Upvotes: 7