comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: WG: SI Units - has Ada missed the boat?
Date: Fri, 13 Jul 2007 22:20:32 GMT
Date: 2007-07-13T22:20:32+00:00	[thread overview]
Message-ID: <pan.2007.07.13.22.22.21.562219@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: 46958287$0$8946$4c368faf@roadrunner.com

On Wed, 11 Jul 2007 21:27:30 -0400, none wrote:

<stuff deleted>

> You can see why the conversion package got so big... it had to defein 
> ALL valid conversions.

Interesting.

I tried out something similar a while back, and the method was to
add the overloaded functions only when they were needed.  I found that
there were rather few overloaded functions needed in practise.  This is
because expressions tend to be rather stereotypical - exotic combinations
of dimensional expressions never arise.  I think my solution used generic
instantiations, in the end, cutting the amount of source.

An interesting project which does include full units and dimensions
support is Sun's Fortress:

http://research.sun.com/projects/plrg/Fortress/overview.html

This is very ambitious and complete in scope - at least for
parallel, concurrent scientific codes.

What do people here think of their efforts?  I don't see Ada
mentioned in their white papers, even although there's a lot
of overlap in requirements.

One interesting feature of Fortress is that "for" loops
execute in any order (or none), by default.  This gives the
very fine grain parallelism opportunities I was talking about
here a while a go.

I think any general purpose language should come with proper
physical types - I'm surprised that it's normally left out.
(VHDL was the first language I used which had them)

As regards Ada and units/dimensions, I think the way forward
for most users is to put the units/physical types into a package
and add overloadings by hand when needed.  More intensive use
warrants the use of generic packages.  It's easy and the incremental
effort is low.

If you want a comprehensive approach, write an Ada preprocessor
to extend the language with a new syntax for dimensional types.
Use something like ASIS as a front end, and spit out standard Ada.
One way would be to check dimensional consistency and then generate
the necessary package(s) with the particular types and functions needed,
adding "with" clauses where necessary.
--
Dr. Adrian Wrigley, Cambridge, UK.




      parent reply	other threads:[~2007-07-13 22:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  8:55 WG: SI Units - has Ada missed the boat? Grein, Christoph (Fa. ESG)
2007-07-09  9:49 ` Dmitry A. Kazakov
2007-07-10  1:26 ` Hyman Rosen
2007-07-10  9:14   ` Martin
2007-07-10  9:22 ` Martin
2007-07-12  1:27 ` none
2007-07-12 10:39   ` Colin Paul Gloster
2007-07-13 22:20   ` Dr. Adrian Wrigley [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox