comp.lang.ada
 help / color / mirror / Atom feed
From: "Alejandro R. Mosteo" <alejandro@mosteo.com>
Subject: Re: package organization (is this doable?)
Date: Fri, 29 Jun 2018 20:47:50 +0200
Date: 2018-06-29T20:47:50+02:00	[thread overview]
Message-ID: <ph5usm$n62$1@dont-email.me> (raw)
In-Reply-To: <lya7rdtuto.fsf@pushface.org>

On 29/06/2018 18:34, Simon Wright wrote:
> "Alejandro R. Mosteo" <alejandro@mosteo.com> writes:
> 
>> package Lib; -- Root package
>>
>> package Lib.Feat_1; -- Some feature
>>
>> package Lib.Feat_2; -- Another feature
>>
>> private package Lib.Impl; -- Things I want to keep secret,
>> conceptually they're in the private part of Lib IIUC.
>>
>> Am I right that it is impossible for Feat_1 and Feat_2 to communicate
>> using something that's private in Lib or Lib.Impl? That would mean
>> exposing those private types in their respective public parts, which
>> is a no go.
> 
> Lib.Feat_1 & 2 can see the private part of Lib, and the public part of
> Lib.Impl.
> 
> What's wrong with putting stuff in the public part of Lib.Impl? No one
> outside Lib can see it.

in Lib.Feat_1, doing a "with Lib.Impl" results in error
"current unit must also be private descendant of Lib".

I can do (in Feat_1) a "private with Lib.Impl", but then I can use these 
things only in private parts/body of Lib.Feat_1, which are also out of 
bounds for Lib.Feat_2, and viceversa.

Finally, I can make Lib.Impl not private and then it's just inelegant, 
since clients gain access to these declarations. Which is not a big 
issue, but is kind of a public pollution. This is basically what I'm 
doing now with Lib.Feat_X.Impl regular packages.

Thanks,
Álex.


  reply	other threads:[~2018-06-29 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 15:45 package organization (is this doable?) Alejandro R. Mosteo
2018-06-29 16:34 ` Simon Wright
2018-06-29 18:47   ` Alejandro R. Mosteo [this message]
2018-06-29 19:37     ` Simon Wright
2018-07-02  8:23       ` Alejandro R. Mosteo
replies disabled

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