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-03 06:56:43 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!wn2feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C0A5054.E74A82E7@worldnet.att.net> Subject: Re: Another Idea for Ada 20XX X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: NNTP-Posting-Host: x1MO7-377268-Px-45361@rwcrnsc54 X-Complaints-To: abuse@worldnet.att.net X-Trace: rwcrnsc54 1007391402 x1MO7-377268-Px-45361@rwcrnsc54 (Mon, 03 Dec 2001 14:56:42 GMT) NNTP-Posting-Date: Mon, 03 Dec 2001 14:56:42 GMT Organization: AT&T Worldnet Date: Mon, 03 Dec 2001 14:56:42 GMT Xref: archiver1.google.com comp.lang.ada:17338 Date: 2001-12-03T14:56:42+00:00 List-Id: Yes. Units do need to be primitive. I've been thinking about this for a while too, but haven't had the chance to write it up. The idea frankly never occurred to me until Ehud suggested it in a post a few months back. At first I thought "that's nuts". But it isn't :-)... We now have type-safe programming in Ada. But there are two things wanting: (1) unit-safe programming, and (2) automatic unit conversion. These cannot be provided without augmenting the language. (Note: "automatic" does not mean "implicit", it means the compiler does the work for you). This would really complete Ada's support for scalar abstraction. "James Rogers" wrote in message news:3C0A5054.E74A82E7@worldnet.att.net... > [snip...] > > Possible declarative syntax might be: > > type Meters is unit range (0.0..1.0E380); > type Hours is unit range (0.0..9.99E30); Something like that. I don't think this is going to cut it, but you're on the right track.... Unit declarations need to be independent of types. Then a dimensioned type would be created by combining a unit with a representation later on, in the type definition. You need to defer the "binding" of a type to a unit in order to achieve the right level of abstraction. > type Speed is unit(Meters / Hours); I think the correct approach would involve declaring a unit (but not a type) in terms of Meters and Hours (in your example). The programmer would want to call this unit "Meters_Per_Hour", not "Speed". Mark Lundquist