comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Drummond <brian3@shapes.demon.co.uk>
Subject: Re: Exclude parts of a package
Date: Sat, 07 Dec 2013 11:55:16 GMT
Date: 2013-12-07T11:55:16+00:00	[thread overview]
Message-ID: <E0Eou.7937$i03.6842@fx10.fr7> (raw)
In-Reply-To: 52a2df3d$0$24107$2c885b36@post.eweka.nl

On Sat, 07 Dec 2013 09:41:33 +0100, Felix Krause wrote:

> On 2013-12-06 21:27:53 +0000, Shark8 said:
> 
>> On Friday, December 6, 2013 1:48:43 PM UTC-7, Felix Krause wrote:
>>> 
>>> This is an interesting approach, but in my case, that would lead to
>>> massive code duplication 

>> Easy enough solution:
>> 1) Define everything [all of OpenGL, or at least portion-X (X : Types,
>> Functions, etc)] in one big package; for the current version (4.3,
>> IIRC).*
>> 2) Define version-packages which repeat the spec of the appropriate
>> functions and use renames in their body.
>> 3) Use the rename technique given by Brian.

>> Package Main_Stuff is
>>   Procedure Bob;  -- Introduced in v.1.
>>   Procedure Tim;  -- Introduced in v.1.2.
>>   Procedure Dave; -- Introduced in v.1.3.
>>   Procedure Bill; -- Introduced in v.1.3.

> But this would compile all implementation code regardless of the version
> the user requested. Let's say in your example, the actual implementation
> of Tim imports a C function. Even if I compile for version 1., the body
> of Tim will still be compiled, so the resulting binary would still link
> against the backend C function that is wrapped by Tim. So to execute the
> binary, I'd need C library version that supports Tim even though I don't
> use it. Or do I see this wrong?

As I understand it, they would all be compiled, but (unless the linker is 
completely brain-dead) only the ones you use would be linked.

So Tim's functions would be verified as syntactically correct (or you'd 
have to fix them!) even though your latest changes were only to upgrade 
v1. And I see that as a Good Thing since it reduces surprises for v1.2 
users of the package...

But Tim shouldn't be linked into the executable; therefore its dependency 
on the C library should also be eliminated. 
(This may require some linker options in the project file)

If the linker really can't do it, then I would 
(a) be surprised, and
(b) suggest refactoring the variants into different packages such that
v1_pkg is base_pkg,
v1.1_pkg is composed of base_pkg and v1.1_diff_pkg
and so on. 

- Brian

  reply	other threads:[~2013-12-07 11:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 20:13 Exclude parts of a package Felix Krause
2013-12-06  1:58 ` gautier_niouzes
2013-12-06  7:51 ` Chris Moore
2013-12-06  8:04 ` playerdark
2013-12-06 11:14 ` Brian Drummond
2013-12-06 11:14 ` Brian Drummond
2013-12-06 11:41 ` Brian Drummond
2013-12-06 20:48   ` Felix Krause
2013-12-06 21:27     ` Shark8
2013-12-07  8:41       ` Felix Krause
2013-12-07 11:55         ` Brian Drummond [this message]
2013-12-08 20:00 ` Stephen Leake
2013-12-12 14:30   ` Marius Amado-Alves
2013-12-13 13:16     ` Felix Krause
2013-12-13 16:17     ` Stephen Leake
2014-01-02 15:06       ` Marius Amado-Alves
2014-01-02 15:07       ` Marius Amado-Alves
replies disabled

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