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,1dd28d5040ded1f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-16 06:44:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Announce: Grace project site operational Date: 16 May 2002 09:35:16 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <4519e058.0205140718.3ddb1b2a@posting.google.com> <3CE15D0A.3050100@mail.com> <3ce21f37$1@pull.gecm.com> <3CE2AB7E.AD4A9956@san.rr.com> <3CE2B842.7060705@mail.com> <3CE2F4E3.DABF19D7@san.rr.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1021556537 5370 128.183.220.71 (16 May 2002 13:42:17 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 16 May 2002 13:42:17 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:24190 Date: 2002-05-16T13:42:17+00:00 List-Id: Darren New writes: > Well, it does just seem to me pretty trivial to write a program that > takes something like > > =distance > =time > velocity=distance/time > area=distance*distance > volume=distance*distance*distance > > and turn such a file into the appropriate set of Ada type and function > declarations, whether it's 50 lines or 5000 lines, that when "with"ed > and "used" could make for safe unit conversions. I agree, it could be done. Please do it! > You need another unit? Add it to the file and regenerate the Ada. I > mean, basically, isn't this what the C++ compiler is doing with the > templates, Yes. > except only creating those combinations you use? I think this is critical. In a complex system, the Ada code you generate will be huge, and could have an impact on compilation time. GNAT's 'pragma Elaborate' and 'gnatelim' could be used to trim the Units package after the system is built. It would be useful to do the experiment and find out if this is worth it. However, my personal belief is that units should be checked at algorithm design time, which I prefer to do in Macsyma or Mathematica for any moderately complex system. So I don't need the Ada code to also check the units. I guess if I had the 'Auto_Unit_Package', I might skip the Macsyma step for more programs. Hmm. > Of course, it could be made much more sophisticated too. In what way? > Or don't Ada people do things like that? :-) Well, I have done something sort of like that, with Auto_Text_IO (http://users.erols.com/leakstan/Stephe/Ada/auto_text_io.html). This package automatically generates Text_IO Put and Get for record and array types; something that is tedious to do by hand, but useful for unit testing, and therefore a good candidate for automation. Also, I believe parts of the GNAT compiler are tool-generated. -- -- Stephe