For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > Fortran and Python (was Re: Statement function host association)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Fortran and Python (was Re: Statement function host association)
beliavsky@aol.com

2005-05-19, 4:01 pm

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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com