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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,608011466ae2af71 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.223.73 with SMTP id qs9mr468941pbc.7.1341261725496; Mon, 02 Jul 2012 13:42:05 -0700 (PDT) Path: l9ni10639pbj.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: GNAT and Dimension Checking Date: Mon, 2 Jul 2012 13:42:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <2afdc8e6-def0-4a00-8535-4db40165fc92@googlegroups.com> <3c38572a-c06c-4b58-9405-ece43483b3cd@googlegroups.com> NNTP-Posting-Host: 149.32.224.33 Mime-Version: 1.0 X-Trace: posting.google.com 1341261725 21817 127.0.0.1 (2 Jul 2012 20:42:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 2 Jul 2012 20:42:05 +0000 (UTC) Cc: nma@12000.org In-Reply-To: <3c38572a-c06c-4b58-9405-ece43483b3cd@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.33; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-07-02T13:42:04-07:00 List-Id: On Sunday, July 1, 2012 3:44:19 AM UTC-7, (unknown) wrote: > This feature is rather limited though. For example one cannot do conversions. If you have to work with an "irregular" unit, you will have to do the conversion yourself e.g. > > with System.Dim.MKS; use System.Dim.Mks; > with System.Dim.Mks_IO; use System.Dim.Mks_IO; > with Text_IO; use Text_IO; > > procedure Free_Fall3 is > subtype Acceleration is Mks_Type > with Dimension => ("m/s^2", Meter => 1, Second => -2, others => 0); > G : constant acceleration := 127137.6 * km/(hour ** 2) ; > T : Time := 10.0/3600.0 * hour; > Distance : length; > > begin > Put ("Gravitational constant: "); > Put (G, Aft => 2, Exp => 0); Put_Line (""); > Put ("Time: "); > Put (T, fore => 4, Aft => 4, Exp => 0); Put_Line (""); > Distance := 0.5 * G * T ** 2; > Put ("distance travelled in 10 seconds (or 10/3600 hour) of free fall "); > Put (Distance, fore => 4, Aft => 4, Exp => 0); > Put_Line (""); > end Free_Fall3; I may be off track here. That is I thought I understood aspect syntax until I browsed to the definition of System.Dim.Mks.Mks_Type type. type Mks_Type is new Long_Long_Float with Dimension_System => ( (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'), (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'), (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'), (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'), (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => "Theta"), (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'), (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J')); Can anyone point me to the ARM 2012 paragraph(s) which supports this syntax in general. Thanks. Anh Vo