简体   繁体   English

如何在ada中使用一个语句包含多个包?

[英]How to include multiple packages with one statement in ada?

I wrote a library in Ada and I would like for the client to only need to include one package into their code. 我用Ada写了一个库,我希望客户只需要在他们的代码中包含一个包即可。 Something like: 就像是:

with all_packages;

That will include all the packages useful for the client. 这将包括对客户端有用的所有软件包。 I wrote the library with one package for each tagged type to keep things simple and easy to read. 我为每种标记类型编写了一个带有一个包的库,以使事情变得简单易读。

How do I give the library user the possibility to include all packages with only one statement? 我如何使库用户可以仅用一条语句包含所有软件包?

You can't. 你不能

You did well by encapsulating each tagged type in its own package, that's the approach recommended for object-oriented programming in Ada. 通过将每个标记的类型封装在自己的程序包中,您做得很好,这是Ada中面向对象编程推荐的方法。

Client code then simply 'withs' just those packages it needs. 然后,客户代码只需“附带”所需的那些软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM