From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c7c302806c75a91b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.68.248.34 with SMTP id yj2mr2690753pbc.2.1352353191782; Wed, 07 Nov 2012 21:39:51 -0800 (PST) From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Design by contract and control inversion Date: Fri, 02 Nov 2012 13:32:05 +0100 Organization: Ada @ Home Message-ID: References: <13ce31f3-34c8-4e08-b45f-cbed9e4ffefe@googlegroups.com> NNTP-Posting-Host: kkBNy2WMHv5wPgXyHzithg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Path: s9ni86875pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.mccarragher.com!news.grnet.gr!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-11-02T13:32:05+01:00 List-Id: Le Fri, 02 Nov 2012 09:59:53 +0100, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > [=E2=80=A6] > package ABC.Sets.Base is > > [=E2=80=A6] > package ABC.Sets.Functional is > Out of the primary topic, but a tiny tip I forgot while posting the = excerpts (as it may be worth to people discovering Ada). Replace the beginning of `ABC.Sets.Base`, with the following: package ABC.Sets.Base is package Formals is subtype Element_Type is Base.Element_Type; subtype Cardinal_Type is Base.Cardinal_Type; end Formals; Then replace the beginning of `ABC.Sets.Functional` with the following: package ABC.Sets.Functional is package Formals is package Base renames Functional.Base; end Formals; That's a useful tip, which will allow you to access the formal parameter= s = of an instance of a generic package, whenever needed. Otherwise, as an = example, `Base.Cardinal_Type` won't be visible from outside of its = hierarchy, if ever you needed to refer to it this way. Instead of = `Base.Cardinal_Type` you will then do `Base.Formals.Cardinal_Type`, and = = will be OK. This question used to be discussed about two years ago on th= is = Usenet. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity