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,6353697ffeb79d16 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news4.google.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Encapsulating Ada.Direct_IO Date: Wed, 17 Nov 2010 23:32:19 +0100 Organization: Ada @ Home Message-ID: References: <5ba4147a-6099-4a05-b548-09544f58247a@j18g2000yqd.googlegroups.com> NNTP-Posting-Host: w00cPq0BvzOlRCSRJJEoeQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.63 (Win32) Xref: g2news2.google.com comp.lang.ada:16528 Date: 2010-11-17T23:32:19+01:00 List-Id: Le Wed, 17 Nov 2010 05:44:49 +0100, Bryan a = =C3=A9crit: > Spec file: > ... > private > package Byte_IO is new Ada.Direct_IO(Character); > type File_Type is new Byte_IO.File_Type; > end Big5_Text_IO; > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Why did you used a =E2=80=9Ctype new=E2=80=9D ? Unless you give some rea= son, subtype is = better better here, as this avoid un-meaningful conversions every where.= = If the type was defined in the public part, the type-new would have make= = sense, but here it is defined in the private part, so no need to use = type-new, unless you want to attach it some special invariants which are= = not part of the invariants of your Byte_IO.File_Type. When you begin with Ada, you oftenly forget to make a good choice betwee= n = type-new and subtype (probably because there is no such things with any = = other language). Always balance type-new and subtype and don't = systematically use type-new all the way. Make choices with reasons. -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens. =E2=80=9CI am fluent in ASCII=E2=80=9D [Warren 2010]