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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.73.22 with SMTP id w22mr857486ywa.19.1446117907572; Thu, 29 Oct 2015 04:25:07 -0700 (PDT) X-Received: by 10.50.225.70 with SMTP id ri6mr239246igc.9.1446117907530; Thu, 29 Oct 2015 04:25:07 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!m48no3247660qgd.0!news-out.google.com!z4ni39763ign.0!nntp.google.com!i2no374287igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 29 Oct 2015 04:25:06 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=91.55.214.218; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 91.55.214.218 References: <87twpd2qlo.fsf@theworld.com> <1pj15r7pul7f1.15qgdyrc8k133$.dlg@40tude.net> <87pp0030c1.fsf@theworld.com> <135hiczk56x02.1xixcme8btbl4.dlg@40tude.net> <1dzlgoh4u2j7t$.1un3dfy0oeigd$.dlg@40tude.net> <190shqocxd87d$.1d68ghgqgbvfs$.dlg@40tude.net> <87d1vy3f46.fsf@theworld.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7e1b4b17-c769-4aa5-a085-a2ccf2ac75ea@googlegroups.com> Subject: Re: function Is_Open (File : File_Type) return Boolean; :Text_io From: AdaMagica Injection-Date: Thu, 29 Oct 2015 11:25:07 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28110 Date: 2015-10-29T04:25:06-07:00 List-Id: Am Mittwoch, 28. Oktober 2015 22:02:17 UTC+1 schrieb Dmitry A. Kazakov: > > In Ada, we can write: > >=20 > > type Gizmo_Count is range 0 .. 2**10; > > Num_Gizmos: Gizmo_Count :=3D 0; > >=20 > > IMHO, documenting the 0..1024 requirement in executable code is much > > better than using a comment: >=20 > How is that documenting? It is a direct instruction to the compiler. > Documentation is addressed to the human reader. >=20 > The advantage of Ada over C is that where in Ada you can instruct, in C t= he > only way is to document. IMHO, this is again a case of Dmitry's special nomenclature: Documentation is not what is evaluable by the compiler; documentation is in= comments or in separate documents (like design docs). I think the Ada community has a different bias: Expressing requirements, i.= e. documentation, in code is preferable. Thus we use Natural rather than In= teger for counting, use constraints like above in Gizmo. And we call this = *documenting*. This is both, an instruction for the compiler *and* informat= ion addressed to the reader. My two EURO cents.