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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to make tasks to run in parallel Date: Tue, 17 Oct 2017 12:04:22 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <08b898a2-168e-4740-9c6e-8f2d9abf7093@googlegroups.com> <3aebc413-4284-41f4-a31c-45091a31d2b3@googlegroups.com> <73fc1d87-09fc-49fb-be48-121969a9cecd@googlegroups.com> NNTP-Posting-Host: lKHBldubgAWx1EqbQpQ5LQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:48493 Date: 2017-10-17T12:04:22+02:00 List-Id: On 17/10/2017 11:06, reinert wrote: > My current understanding of Ada is mainly from John Barnes, > "Programming in Ada 2012". On page 243 he introduces new (derived) types > for number of apples and oranges, so one can write: > > No_Of_Apples := No_Of_Apples + 1; > No_Of_Oranges := No_Of_Oranges + 1; > > But one cannot write: > > No_Of_Apples := No_Of_Oranges + 1; -- error > > Using derived types here seems "clean" to me and contributing to avoid future errors. This is not how dimensioned values are used in practice. The problem is that you frequently need No_Of_Fruits too. No_Of_Fruits := No_Of_Apples + No_Of_Oranges; -- This is OK For dimensions consider writing a dimensioned calculator, GUI, DB storage, communication protocol etc. In terms of types, one need to have values of any, unspecified at compile time, dimension. This is like a class-wide value which may have any tag or an unconstrained value, e.g. String which may have any length. I leave the question whether the dimension of an object may change. That is not so important for numbers (by-value things), however less so in the case dimensioned containers (vectors, matrices etc by-reference stuff). Anyway, one could go along with immutable dimensions, but static-only dimensions is a non-starter. When unconstrained dimensioned values are manipulated, the dimensions must be checked dynamically. When statically constrained values are, the dimensions better be checked statically. This is very difficult to achieve. Existing solutions are either fully dynamic or fully static. The latter is unusable for practical purposes, e.g. in automation and control systems. The former is inefficient and statically unsafe when dimensions are indeed known. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de