comp.lang.ada
 help / color / mirror / Atom feed
* basic question on nested packages
@ 2012-07-28  3:22 Nasser M. Abbasi
  2012-07-28  5:27 ` Nasser M. Abbasi
  2012-07-28 12:19 ` Niklas Holsti
  0 siblings, 2 replies; 11+ messages in thread
From: Nasser M. Abbasi @ 2012-07-28  3:22 UTC (permalink / raw)


I'd like to improve the structure of the Ada lapack binding
to make it easier to use.

The official Fortran lapack is structured as follows

                                lapack
                                  +
                                  |
                 +----------------+-------------------+
                 |                |                   |
              driver routines    computational     auxiliary

The current Ada Lapack binding has the following 4 packages
that maps to the above, and a package for IO, like this:

labase.ads  (provides only data types)

ladrv.ads (the drivers API's, WITH labase;)
laaux.ads (the auxillary API's, WITH labase;)
lacmp.ads (the computional API's, WITH labase;)

then an IO package
labaseio.ads, labaseio.adb (WITH labase;) provides IO routines
for the lapack Ada types.

So, a client Ada program that wants to use lapack's driver
routine say SGESV() would do

-------------------
with labase; use labase;
with ladrv;
....
     A    : labase.Fortran_Real_Matrix (1 .. 3, 1 .. 3);
     ladrv.SGESV(...)
------------------------

What I think would be better is to have ONE lapack package and
with the above packages as nested packages. So that a client
program would do

-------------------
with lapack;

....
     A    : lapack.Fortran_Real_Matrix (1 .. 3, 1 .. 3);
     lapack.driver.SGESV(...)
------------------------

i.e. a client would only need to WITH one package, and
access the other packages using a dot from that one base package.

Hence it will be, for the API's

    lapack.driver.foo()
    lapack.comp.foo()
    lapack.aux.foo()
    lapack.IO.foo()

and for the datatypes, it will just be

    A : lapack.type_name;

The 4 ada lapack packages (driver, comp, aux, IO) all do
WITH labase;  So putting them as nested packages to labase
seems to make sense.

I do not know much about Ada packaging and such, so wanted to ask
the experts what they think. Woukd nested packages be the answer,
or some other stucture? or should the API be left as is?

There will be no code changes in the packages itself, just
a bit of shuffling of the code location in the files to make it
easier and more clear to use the binding. I think the client will
be more clear this way.

Any thoughts?

--Nasser



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-08-07  6:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-28  3:22 basic question on nested packages Nasser M. Abbasi
2012-07-28  5:27 ` Nasser M. Abbasi
2012-07-28  5:36   ` Shark8
2012-07-28  9:01     ` Nasser M. Abbasi
2012-07-28  9:53       ` AdaMagica
2012-07-28 12:54         ` J-P. Rosen
2012-07-28 12:19 ` Niklas Holsti
2012-07-28 12:52   ` Nasser M. Abbasi
2012-07-28 13:34     ` Niklas Holsti
2012-07-29  1:19       ` Nasser M. Abbasi
2012-07-29 23:05         ` Niklas Holsti

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