From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Problematic type definition in Interfaces.Fortran
Date: Mon, 26 Nov 2001 16:15:14 +0100
Date: 2001-11-26T16:15:14+01:00 [thread overview]
Message-ID: <3C025C82.55727A37@nbi.dk> (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.
reply other threads:[~2001-11-26 15:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox