Fortran Library of the Today: FLAP

Today’s Fortran Library of the Today is FLAP (Fortran command Line Arguments Parser for poor people)

From FLAP’s Github page:
A KISS pure Fortran Library for building powerful, easy-to-use, elegant command line interfaces

  • FLAP is a pure Fortran (KISS) library for building easily nice Command Line Interfaces (CLI) for modern Fortran projects;
  • FLAP is Fortran 2003+ standard compliant;
  • FLAP is OOP designed;
  • FLAP is a Free, Open Source Project.

FLAP is inspired by Python’s argparse library which involves instantiating a CLI object, registering options and arguments along with descriptions, optional/required status, argument count and type, etc., then parsing and evaluating the command line arguments. The library also generates help/usage messages, manual pages, and other user documentation and handles any errors in user input.

I have yet to put FLAP through its paces but it looks like a great candidate for the Hypothetical Fortran Standard Library!

What I Miss When Writing Fortran

I work in a number of different languages depending on the project. For rapid prototyping I use Jupyter Notebook with Python 2 or 3 which is then converted to standalone code, documents are written in Markdown or LaTeX and compiled to HTML or PDF, Fortran is used for heavy computation, etc. I also revitalize a lot of legacy FORTRAN IV and FORTRAN77 code so I frequently find myself wishing I had the capabilities found in the standard libraries of more modern languages. I also miss certain language-specific development tools which don’t have a Fortran equivalent.

Read moreWhat I Miss When Writing Fortran

What Should a Fortran Standard Library Contain? Part 2

In the previous post, I lamented the lack of a standard library in Fortran and briefly reviewed the contents of the standard libraries for both C and Python. While these languages serve different roles than Fortran, they are popular and mature and I felt they were worth investigating for inspiration. This post covers two topics: first, I present a brief summary of how a hypothetical Fortran Standard Library could be created and adopted (the “Big Picture“), and second I look at the standard libraries of Julia, R, and Ada.

The Big Picture approach I am taking is to:

  1. describe the problem (lack of a standard library),
  2. show how other languages address it,
  3. set high level policies and goals,
  4. define & implement an achievable initial library,
  5. have people use it and provide feedback, and,
  6. iterate over 4 through 6 until the library is stable, adjusting the policies and goals in 3 to ensure the library is implementable, stable, usable, and meets with community approval.

Following this model, we can define high-level capabilities we want in a standard Fortran library and then get into the details of what functions are necessary. In software engineering terms, that means setting requirements and creating design and functional specifications.

Read moreWhat Should a Fortran Standard Library Contain? Part 2

What Should a Fortran Standard Library Contain? Part 1

One of Fortran’s major drawbacks is its lack of a standard library, a formally defined set of components outside the language core which are supplied along with the compiler. Recent revisions of the Fortran standard have defined several standard modules (ISO_C_BINDING and ISO_FORTRAN_ENV are the two best known) but these do little more than define constants and data types. As of 2017, there are no standard libraries for (say) operating system or filesystem access, string handling, searching and sorting, or networking.

Since Fortran is primarily used for numerical computing, the lack of a standard network library may not be a great disadvantage. However the lack of filesystem tools and text manipulation and parsing tools severely limit the utility of the language.

Before asking what should be in hypothetical Fortran Standard Library, it might be helpful to review what’s in the standard libraries of other languages such as C and Python.

Read moreWhat Should a Fortran Standard Library Contain? Part 1