comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Suggestions needed to split a package
Date: Fri, 24 May 2019 15:26:02 -0500
Date: 2019-05-24T15:26:02-05:00	[thread overview]
Message-ID: <qc9k0q$tah$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: qc9595$ime$1@dont-email.me

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

"Björn Lundin" <b.f.lundin@gmail.com> wrote in message 
news:qc9595$ime$1@dont-email.me...
> Den 2019-05-24 kl. 17:49, skrev A. Cervetti:
>> A package in the program I am writing is getting too long.
>> So I thought it would be a good idea to split it.
>>
>> The package is here: 
>> https://github.com/andreacervetti/ada-virt-monitor/tree/master/avm/src/monitor 
>> (files monitor-structures.ad*).
>>
>> My problems are:
>> I'd like to avoid forcing clients of the package to "with" too many 
>> modules.
>> I want keep private types private.
>
> If it is only file size that is your concern, you
> can look at moving some functions via 'separate' to other files.
> It does not change your structure, and clients of
> the package does not know -> not more withs than current solution

Yes, although if there are a lot of small subprograms, it's not very 
effective as you would end up with a *lot* of files (making it hard to find 
things and slowing compilation). And you can't make overloaded subprograms 
separate (the names have to be unique).

But besides that, you've specified an impossible problem. If you split 
something, you necessarily end up with more units - that's the point. And 
more units mean more "withs". As with everything, there are trade-offs. If 
there are natural divisions, putting some parts into child units may make 
sense. Users that need *everything* would have more withs, but few users 
need everything. So only people that need some subsystems would need to with 
those; that is often the best strategy. But of course every case is 
different.

                                Randy.





  reply	other threads:[~2019-05-24 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24 15:49 Suggestions needed to split a package A. Cervetti
2019-05-24 16:14 ` Björn Lundin
2019-05-24 20:26   ` Randy Brukardt [this message]
2019-05-24 21:21     ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox