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 X-Google-Thread: a07f3367d7,3ef3e78eacf6f938 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3? Newsgroups: comp.lang.eiffel,comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <19vb3fanruozp.kpikpepa685o.dlg@40tude.net> Date: Tue, 21 Jul 2009 14:43:22 +0200 Message-ID: <1aixm1hcuauqn.94np9b2l8wtv$.dlg@40tude.net> NNTP-Posting-Date: 21 Jul 2009 14:43:22 CEST NNTP-Posting-Host: cac30c57.newsspool4.arcor-online.net X-Trace: DXC=^SAQI9]99M^5TOT9_N5i On Tue, 21 Jul 2009 13:08:36 +0000, Colin Paul Gloster wrote: > On Tue, 21 Jul 2009, Dmitry A. Kazakov wrote: > >|----------------------------------------------------------------------| >|"[..] | >| | >|[..] In fact there is no language with a good support of units. Ada is| >|not an exception here. | >| | >|[..]" | >|----------------------------------------------------------------------| > > Though Dmitry A. Kazakov and I both like Ada, we do not necessarily > agree as to what constitutes good support of units. Ada provides the > mapping > Type * Type -> Type > and ML provides the mapping > Type x Type -> (Type x Type) > and both of these can be worthy without being universally > desirable. It might be nice to have a language which supports both of > these kinds of mappings. (If you consider static algebraic operations on types, then Ada supports Cartesian product of types as well: that is standard record types.) The problem with "good" units support is that you need both statically and dynamically constrained (by the dimension) types, which are not only numeric, but also containers. Ada (and any other language I know) lack means to express the way dimension constraints propagate through (annotate) type algebraic operations (like "A is array of T") rendering the operations of the resulting types as unit-aware. Further these operations are normally cross-typed (matrix of velocities multiplied by a vector of durations). Ada's type system does not capture relations between types other than inheritance. Maybe the algebra of dimensioned types can be expressed by inheritance, maybe not. But Ada's inheritance is too weak for this. And this is just a beginning, not even an end of the beginning. Consider the thing other languages just ignore, I mean accuracy of the numeric operation. In Ada we carefully specify the precision of the types we declare. Now imagine these types annotated by dimensions. What happens with the accuracy of computations of the data in inches performed in meters? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de