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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Wed, 4 Oct 2017 23:45:37 +0200 Organization: A noiseless patient Spider Message-ID: References: <325cf1db-bd9e-4f58-a07b-f297960df269@googlegroups.com> <457e2526-d4b6-4999-8521-64f8b6a0810f@googlegroups.com> <561e1aa0-d6a5-40cf-a585-e31aef767460@googlegroups.com> <19dac7a1-0d8f-407b-91a1-864881f97ea5@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 4 Oct 2017 21:45:38 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="18428d1d048bb48e5b16ab71e5b26c4e"; logging-data="18685"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fLnequKkJK1EI3/Rthrm/8Yf1XBwFArE=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 In-Reply-To: <19dac7a1-0d8f-407b-91a1-864881f97ea5@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:oSJqXP7xK7w0ulfWVvK62ZGvstE= Xref: news.eternal-september.org comp.lang.ada:48355 Date: 2017-10-04T23:45:37+02:00 List-Id: On 04.10.17 21:21, reinert wrote: > On Tuesday, October 3, 2017 at 8:36:22 AM UTC+2, G.B. wrote: >> On 03.10.17 05:30, reinert wrote: >>> I noticed that my compiler did not like for example: >>> >>> t1 : time := clock + 10.0; >>> t2 : time := t1 + 20.0; >>> t3 : time range t1 + 10.0 .. t2 + 30.0; >>> >>> >>> No room for syntactic sugar here? :-) >> >> For a start, the compiler has no idea what "20.0" should >> mean with regard to Time. >> > > My compiler (gnat on debian) says "clock + 20" means 20 seconds > into the future :-) Assuming I have not misunderstood. That was confused. What I meant was that 20.0 Time has no meaning, since time (moment) is not itself countable, but duration or span are. Ada ranges would also be used in for loops that make the program step through the set of values of the range: for Moment in Candy_Time range t1 .. t2 loop null; -- How many iterations will there be? end loop; No such problem when using countable units of time: procedure Candy is T1 : Day_Number := Day (Clock); T2 : Day_Number := T1 + 10; begin for Day in Day_Number range t1 .. t1 loop null; -- 10 + 1 iterations! end loop; end Candy; Thus, by use of proper types the program becomes predictable at the source level.