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,FREEMAIL_FROM autolearn=ham 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.228.227 with SMTP id sl3mr7628598pbc.5.1341139925737; Sun, 01 Jul 2012 03:52:05 -0700 (PDT) Path: l9ni5722pbj.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: yogeshwarsing@gmx.com Newsgroups: comp.lang.ada Subject: Re: GNAT and Dimension Checking Date: Sun, 1 Jul 2012 03:44:19 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3c38572a-c06c-4b58-9405-ece43483b3cd@googlegroups.com> References: <2afdc8e6-def0-4a00-8535-4db40165fc92@googlegroups.com> NNTP-Posting-Host: 193.11.21.204 Mime-Version: 1.0 X-Trace: posting.google.com 1341139925 18963 127.0.0.1 (1 Jul 2012 10:52:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 1 Jul 2012 10:52:05 +0000 (UTC) Cc: nma@12000.org In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.11.21.204; posting-account=Rr9I-QoAAACS-nOzpA-mGxtAlZ46Nb6I User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-07-01T03:44:19-07:00 List-Id: 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; You will still get the outputs in the default MKS units. So basically, it is just checking if your dimensions are right. And I do not think that you are able to deal with record constructs such as type Motion_Parameter is record Radius: Length := 0.0 * m; Speed : Velocity := 0.0 * m/s; Time_Step : Time := 0.0 * s; Number_Of_Revolutions : Float := 0.0; end record; since Motion_Parameter will need to have a specific dimension in terms of MKS and having different MKS units in the record structure makes this impossible. YC