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: 103376,c7c302806c75a91b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.66.74.72 with SMTP id r8mr1048358pav.32.1352252101326; Tue, 06 Nov 2012 17:35:01 -0800 (PST) Path: 6ni66587pbd.1!nntp.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail 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: Wed, 07 Nov 2012 02:34:58 +0100 Organization: Ada @ Home Message-ID: References: <13ce31f3-34c8-4e08-b45f-cbed9e4ffefe@googlegroups.com> NNTP-Posting-Host: aWaWeUaBdaj2Zzc04J1v5A.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 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-11-07T02:34:58+01:00 List-Id: Le Fri, 02 Nov 2012 09:59:53 +0100, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > -- abc-sets-base.ads > > generic > > type Element_Type is private; > type Cardinal_Type is (<>); > > package ABC.Sets.Base is As it was posted, a note on this. The `Cardinal_Type` is just a discrete type here, which may looks = over=E2=80=91generalized to somebodies, and indeed the standard Ada cont= ainers use = a range type instead. The discrete type is enough even for a = implementation, but if you wish to add pre/post condition on the = cardinality in the specification, then a discrete type becomes a burden = = (unless you enjoy Peano arithmetic a lot). There's no real rule here, th= at = just depends=E2=80=A6 Just still one thing: that's always OK to change f= rom the = discrete type to a range type, but not the opposite; so that may be bett= er = to start with the discrete type and change this later if required. -- = =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