comp.lang.ada
 help / color / mirror / Atom feed
* Problematic type definition in Interfaces.Fortran
@ 2001-11-26 15:15 Jacob Sparre Andersen
  0 siblings, 0 replies; only message in thread
From: Jacob Sparre Andersen @ 2001-11-26 15:15 UTC (permalink / raw)


I have noticed what I consider a rather problematic type
definition in package Interfaces.Fortran. RM B.5(9):

type Complex is new Single_Precision_Complex_Types.Complex;

Since package
Ada.Numerics.Generic_Complex_Elementary_Functions is
instantiated using an instantiation of package
Ada.Numerics.Generic_Complex_Types, it is not possible to
instantiate it for type Interfaces.Fortran.Complex.

And authors of Fortran bindings (such as "lapada") have a
habit of using type Interfaces.Fortran.Complex. :-(

Here is a code example that illustrates the problem:

----------
with Ada.Numerics.Generic_Complex_Elementary_Functions;
with Interfaces.Fortran; use Interfaces.Fortran;

procedure Hack_Virker is
   package KomplekseFunktioner is
     new Ada.Numerics.Generic_Complex_Elementary_Functions
       (Interfaces.Fortran.Single_Precision_Complex_Types);
   use KomplekseFunktioner;

   Psi :
Interfaces.Fortran.Single_Precision_Complex_Types.Complex;
   II  : constant
Interfaces.Fortran.Single_Precision_Complex_Types.Complex
           := (0.0, 1.0);
begin -- Hack_Virker
   Psi := Exp(II);
end Hack_Virker;
----------

The problem is that since "Interfaces.Fortran.Complex" is
derived from
"Interfaces.Fortran.Single_Precision_Complex_Types.Complex",
and not just a subtype of
"Interfaces.Fortran.Single_Precision_Complex_Types.Complex",
there is no package to use for instantiating package
Ada.Numerics.Generic_Complex_Elementary_Functions.

Is there a very good reason for not making
"Interfaces.Fortran.Complex" a subtype of
"Interfaces.Fortran.Single_Precision_Complex_Types.Complex"?

Jacob
-- 
Sk�ne Sj�lland Linux User Group - http://www.sslug.dk/
N�ste m�de: IT-lovgivning.
Tirsdag den 27. november 2001 i Symbion, Fruebjergvej 3.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-11-26 15:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-26 15:15 Problematic type definition in Interfaces.Fortran Jacob Sparre Andersen

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