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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc4f25d878383cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-07 03:51:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!news.kvaerner.com!news@kvaerner.com From: "Tarjei T. Jensen" Newsgroups: comp.lang.ada Subject: Re: Another Idea for Ada 20XX Date: Fri, 7 Dec 2001 12:49:18 +0100 Organization: Kvaerner Group IT Message-ID: <9uqac8$des1@news.kvaerner.com> References: <3C0AACCE.329CFB60@worldnet.att.net> <45601fc.0112031740.3e217c8a@posting.google.com> <3C0CF4E3.A53D20A7@sparc01.ftw.rsc.raytheon.com> <3C0EF0A0.9F42EDB4@adaworks.com> NNTP-Posting-Host: 155.209.159.202 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 4.72.2120.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Xref: archiver1.google.com comp.lang.ada:17557 Date: 2001-12-07T12:49:18+01:00 List-Id: Richard Riehle wrote >Correct. However, a simple type declaration is just part of the >solution. >I don't believe it requires a change to the language. Rather, it begs >for a >simple object-oriented programming solution, along with some >old-fashioned >encapsulation. > > package Metric_Number is > type Metric_Type is private; > -- export services for arithmetic on this type > function "+"(L, R : Metric_Type) return Metric_Type; > -- more arithmetic and boolean functions > private > -- full definition for the Metric_Type; > -- helper type to avoid recursion during implementation > end Metric_Number; I think my suggestion (long time ago) of having a "universe" where one defines how the datatypes interact is a far better idea. The compiler would know that multiplying meter by meter would result in meter squared and that this would not be assignment compatible with meter. There would be no need for units since one would be able to specify wheter an integer would have to be typed in order to be used in an expression. Greetings,