Lähettäjä: kc-devuan Päiväys: Vastaanottaja: dng Aihe: Re: [DNG] Ada strings
7 Oct 2024 04:53:47 Steve Litt <slitt@???>:
> Can I declare a package
> in the same file as my main program is in?
I believe so. That would be a nested package which can be useful for namespaces in an object oriented design fashion. AdaCore describe them as an advanced feature but I'm not sure why.
package whatever is
subtype something is Ada.Character range (A .. F);
end whatever.
Then whatever.something;
On a side note if you look at the adacore info on packages then I personally prefer not to use use clauses when withing (#include but better) non nested packages myself. More verbose and longer lines but provides for some nice dot notation. AdaCore disagree so it isn't always clear which functions/procedures are being called from which packages in their examples especially when new. I might open an issue on their learn github.