JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for COMP-FORTRAN-90 Archives


COMP-FORTRAN-90 Archives

COMP-FORTRAN-90 Archives


COMP-FORTRAN-90@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

COMP-FORTRAN-90 Home

COMP-FORTRAN-90 Home

COMP-FORTRAN-90  1997

COMP-FORTRAN-90 1997

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: wish list of fortran features

From:

Swietanowski Artur <[log in to unmask]>

Reply-To:

Swietanowski Artur <[log in to unmask]>

Date:

Fri, 14 Nov 1997 20:43:19 +0100

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (210 lines)

To my surprise the first message in this thread (?) has also been 
the last until today. I'll try to comment on some of the ideas of 
the original poster. I will remove the parts on which I have nothing 
to say or just nothing to add.

Dr W.W. Schulz wrote:
> 
> General Remarks:
> 
>     These are some wishes that I see as useful from my own programming
>     experience. Of course, not everybody will agree with this rather
>     personal list of wishes.
> <snip>
> Features on my wishlist:
> 
> (o) Status of pointers/allocatable arrays:
>     Pointers  should be either associated or disassociated.
>     Dangling pointers should be caught by the system.

Good to know that someone is concerned about the mess in which 
the pointers and allocatables in F90 are.
1) One can't tell whether a pointer has been allocated or pointer 
   assigned to an allocatable. Thus in general it is impossible to 
   deallocate pointers safely.
2) The behaviour of local allocatable arrays has changed from F90 
   to F95. I'd say the change was from very obviously bad to less 
   obviously bad.

   In F90 an allocatable without the save attribute that was not 
   deallocated before exit would be in some undefined state everafter 
   (I don't remember the exact name of the state, but it's not 
   important here, I guess). It was so obvious a mistake that 
   the behaviour was changed in F95.

   In F95 such allocatable would be automatically deallocated. It's 
   an improvement because the irregularity of an allocatable's state 
   has been removed. It's subtly wrong because:
   a) it may hide a possible bug in an incorrect F90 program which 
      went unnoticed because of some specific compiler implementation,
   b) it may temporarily hide a mistake when the allocatable was
intended 
      by the programmer to be declared with a SAVE attribute,
   c) when this "feature" is deliberately used to save typing effort,
      this promotes a messy programming style in which a program 
      depends on implicit mechanisms.

   In my view the runtime system should detect when an allocated 
   allocatable is left allocated at the exit point of the function 
   and stop the program with an error message.

> (o) enumerated Type:
>     Ada, C/C++, etc have it. It is a very useful and concise way
>     to set up a list of options etc.

I agree enumerated types are very useful. I'd add that (as it was 
discussed in another thread) it would be nice to have constants (not 
just parameters). A possibly useful "definition" of a constant could 
be: an object that is assigned value exactly once during program 
execution, possibly before any other executable statments are executed.

> (o) Shortening of Fortran
>     I think there are many instances where the style of programming
>     could be enhanced by allowing more concise statements,
>     e.g. ALLOCATE( X(1:N)=Zero ) allocates an array X(1:N) and sets
>     all elements to Zero.

In general I disagree. Each such addition would need some extra syntax / 
semantics. The ability to shorten a program by a line or two often 
leads novice C/C++ programmers to write cryptic constructs using large 
numbers of operators. The gain in conciseness is almost immediately 
paid for with program's readability.

In some cases such shortcuts might be useful, but in my opinion 
the example provided by the original poster do not fall into 
this category.

>     The parameter list of Subroutines and Functions could have
>     the declarations of their arguments directly there:
>     SUBROUTINE SUB( Integer, INTENT(IN)  :: A  &
>                    ,Real, INTENT(IN OUT) :: B  &
>                   )
>     instead of repeating it again. It is also less error prone
>     (though most compilers will pick it up).

I have mixed feelings about the above. It works fine with ANSI C, but 
the longish declarations containig many attributes may not be very 
readable.

> (o) Extension of CASE:
>     The current version of the CASE statement is somewhat inconsistent
>     with the rest of the language.  It is a much needed improvement of
>     the IF-block but has been defined, im my opinion, in the wrong way.
> 
>     A more useful form is:
>     SELECT CASE( A )
>            CASE( r1<=A<r2, r3<A<=r4, r5,r6,r7 )    ! r stands for range
>                ...
>            CASE( r2<=A<r3, r8,r9 )
>                ...
>            CASE DEFAULT
>     END SELECT
>     where A can be integer or real or character(ASCII).

I agree that this form of CASE would be appropriate in many cases. 
I disagree with arguments that exact comparisons with real numbers 
should be avoided because they depend on floating point hardware 
(an often cited reason to disallow REALs as loop iterators). 

> (o) Modules:
>  <snip>
>     Secondly, there is the compilation cascade when the implementation
>     of a module is changed but not its (public) interface.
>     These matters leave room for improvements that have to be addressed
>     soon.

Modules as they are designed do not support the separation of 
the interface and implementation. They are simply poorly designed. 
Or perhaps designed for a different purpose.

>     In addition, does the current standard say anything about this:
>     Modules A, B, C
>     B: use A
>     C: use B  ! is A also visible in C through B?

Yes, it's visible. Surprising effects may occur if access protection 
is used in A and B (which also appears later in the original posting).

> (o) Libraries:
>     The step to include a string type (ISO_VARYING_STRING) is a good
>     step and should used more often. Common data structures (such as
>     linked lists, trees, heaps, etc) could be provided to reduce
>     duplication of code, enhance safety, etc. or, at least provide
>     us with model implementations that can be copied.

Right. The problem is, libraries in form of modules may only be 
distributed easily in source form (no way to separate interface 
from implementation).

> (o) Obsolete Features:
> <snip>
>     - DOUBLE PRECISION (use Real(kind=...))

There should be a KIND value defined in the standard that would always 
make REAL(k) the same as DOUBLE PRECISION. After all we have plenty of 
good old F77 code to interface to. And, yes, it used DOUBLE PRECISION 
quite often. In general, there should be predefined KINDS directly
corresponding to the most often used F77 types.

>     - NULLIFY (With the NULL in F95 NULLIFY becomes redundant.)

Too late. Any F90 code using pointers uses NULLIFY now. Besides, I 
don't see any problem with this redundancy.

> (o) IMPLICIT NONE
>     It would have been a good idea to make this the default
>     setting for F90 code in recommended format (i.e. free format)
>     True it makes F77 and F90/95 a little bit imcompatible
>     but safety should take priority.

I'd opt for requiring the compilers to have an appropriate command 
line option.

> (o) SAVE
>     For the sake of transparency, variables should be saved between
>     function calls only if they are declared with the attribute SAVE
>     not just when initialized.
>     This is, however, in conflict with the earlier standards.

Agreed, on both accounts. Since already F95 is not 100% compatible 
with F77, it's probably the right time to do it.

> (o) PARAMETER Variant:
>     I have wished many times to have a variable that can only be
>     declared once at the beginning of a programme and remains constant
>     throughout.

Yes. I wrote about it earlier in this message. There was a (short) 
thread lately in which the differences between PARAMETER's and 
constants were discussed.

> (o) Overloaded Operators
>     allow commutative operators to reduce duplication of coding
>     Also, allow to declare some operators invalid for ADTs. There
>     are times when I don't want an assignment of the intrinsic kind.

Agreed. I want to have:
a) operators like C's +=, -= etc. (for ease of notation as well 
   as efficient code),
b) ability to define my own assignment-like binary operators with 
   the left hand side argument INTENT(INOUT) and right hand side 
   argument INTENT(IN). They should have flexible naming conventions 
   allowing to define more than one such operator for any pair of 
   argument types.

<End of my comments>

I do hope that after all some people will be interested enough to 
comment.

Regards,
----------------------------------------------------------------------
Artur Swietanowski                mailto:[log in to unmask]
Institut fuer Statistik,  Operations Research und Computerverfahren,
Universitaet Wien,  Universitaetsstr. 5,  A-1010 Wien,  Austria
tel. +43 (1) 407 63 55 - 120      fax  +43 (1) 406 41 59
----------------------------------------------------------------------


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
February 2023
November 2022
September 2022
February 2022
January 2022
June 2021
November 2020
September 2020
June 2020
May 2020
April 2020
December 2019
October 2019
September 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
April 2015
March 2015
January 2015
December 2014
November 2014
October 2014
August 2014
July 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
July 2013
June 2013
May 2013
April 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
July 2010
June 2010
March 2010
February 2010
January 2010
December 2009
October 2009
August 2009
July 2009
June 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager