Fortran and Python (was Re: Statement function host association)
- From: beliavsky@xxxxxxx
- Date: 19 May 2005 06:21:05 -0700
James Giles wrote:
> The problem with that is I would prefer that statement functions
> be inherently generic. That is, the return type of the statement
> function should be the result type (rank, KIND) of the expression
> that defines it based on the types (ranks, KINDs) of the actual
> arguments to the function.
Are trying to sneak Python into Fortran? :) Python does not have
declarations, and I think functions in Python have the property you
described.
Some features in Python (and in some other languages) that are
introduced in Fortran 2003 (in a different form) are
(1) classes with inheritance
(2) procedures taking allocatable arrays as arguments and returned
values (F95 already allows pointer arguments)
(3) automatic allocation of arrays in an expression
(my understanding is that if x has known dimensions, and y has not been
allocated yet, and x and y have the same rank, then the statement
y = x
both allocates y and sets its elements equal to those of x)
(5) allocatable structure components
(6) interoperability with C
I think features (2) and (3), along with the array operations and
intrinsic function present since Fortran 90, are giving Fortran some of
the features of a high-level scientific scripting language (similar to
Python with Numarray, or Matlab/Octave/Scilab, or IDL, or R/S-Plus),
which is a good thing IMO, as long as users still get good performance
and stand-alone executables. Getting non-Fortran-95 programmers to
think of the language this way is difficult.
.
- References:
- Statement function host association
- From: John Harper
- Re: Statement function host association
- From: John Harper
- Re: Statement function host association
- From: Richard E Maine
- Re: Statement function host association
- From: Dan Nagle
- Re: Statement function host association
- From: James Giles
- Statement function host association
- Prev by Date: Re: Computing exp(z)
- Next by Date: Re: Computing exp(z)
- Previous by thread: Re: Statement function host association
- Next by thread: How can I read data from ".dat" file to an array?
- Index(es):
Relevant Pages
|