101010.pl is one of the many independent Mastodon servers you can use to participate in the fediverse.
101010.pl czyli najstarszy polski serwer Mastodon. Posiadamy wpisy do 2048 znaków.

Server stats:

504
active users

#fortran

3 posts3 participants0 posts today

New #Fortran post: "Enumeration, part 2" matthiasnoback.nl/2025/06/fort

We increase type safety by narrowing the integer level argument to a derived type argument. By introducing a factory type for log levels we are able to separate responsibilities. Finally we allow level comparisons using operator overloading.

Matthias Noback · Fortran: Enumeration, part 2Type safety, a log level factory, and operator overloading

New #Fortran post: "Module Design" matthiasnoback.nl/2025/06/fort

We look into splitting an existing module into smaller modules. We then put a façade module in front of the smaller modules, so users only have to deal with a simple programming interface. Finally we fix compilation cascade issues by introducing the concept of a submodule.

Matthias Noback · Fortran: Module DesignFortran projects are famous for their large modules. Actually, we may also find very large files in legacy projects written in other languages, like Java, PHP, etc. These projects sometimes have files with thousands of lines of code. Fortran projects suffer more from large files I’d say, because: IDE support is not great. It’s often still hard to navigate to definitions or usages. There isn’t any support for automated refactorings, like extract function, move function, add parameter, etc. You often can’t get a clear overview of the structure/outline of a file. There are no strict indentation rules, making it easy to create a complete mess. Not everyone uses code formatting tools. Code formatting tools that exist and are used, aren’t always very good or easily configurable. Fortran code can be hard to read, partially because a lack of curly braces. It’s hard to visually recognize blocks of code. Another reason is that commonly there’s no distinction in letter casing between type names, function names, variable names, etc. Other languages may use CamelCase for types, CAPS for constants, pascalCase for methods, snake_case for functions, etc. In Fortran code, it’s all snake_case. If there’s anything we can do to make Fortran code easier to deal with, it’s to split the code into smaller parts. We need to have many more modules, each with distinct topics and concerns, so we can get a quick overview of the application’s domain and capabilities. Additionally, this will help us find the right place when we want to make changes to the code.

New #Fortran post: "Modeling Services as Derived Types" matthiasnoback.nl/2025/06/fort

Derived types are good for "data objects", but they can also be used for "service objects". We look at a safe refactoring from module state and subroutines to a derived type with a data component and a type-bound procedure.

Matthias Noback · Fortran: Modeling Services as Derived TypesWe’ve seen how to define a derived type to represent a point in 2D space. We were able to add a type-bound procedure to it, and finally to make its components private and define a custom constructor for it. In essence there are two categories of derived types: Derived types that hold some data. Their type-bound procedures are solely dealing with this data, and may produce valuable information with it. The point is an example of such a derived type: we can use its data to make geometrical calculations, or we can combine it together with other points into lines, polygons, etc. This all happens in memory. In typical business applications you would consider entities, value objects and data transfer objects (DTOs) to be in this first category. Derived types that can perform some task that deals with things external to the application, like a file, the terminal, a network connection, etc. Such a type doesn’t hold data inside. It is able to fetch data, or send/store data. In business applications such a type is often called a service. In object-oriented programming, service types usually offer an abstraction. This allows the client to decouple from its specific implementation details. For example, take a logger service; it’s often beneficial for the user that they don’t have to be concerned about where the logs are written to (file, screen, log aggregation server, etc.). The user only wants to call a simple log() function to log something to whatever has been configured at some higher level. Introducing an logger abstraction will take a few posts from here, but it’s good to know that service abstraction is the goal.

📘 FORTRAN IV Manual (1982), adapted by Rafko Adrinek and published by Iskra Delta! 💖 #FORTRAN was the first widely adopted “standard” programming language, especially popular during the 1960s and 70s — the punch card era. 💾 Back then, it powered massive mainframes, and its legacy still lives on today in modern supercomputer programming! 🚀

Pondering if I dare to put #Fortran into my CV. :blobcatthinking:

I can do some Fortran, partly because it keeps coming up in all sorts of #retrocomputing contexts, but, even with Ratfor enhancements, I don't consider it a well-designed or pleasant language, and I'm not sure I can see myself working at a place that deals in new Fortran code now that nice, human-friendly languages such as NumPy and APL have been invented. Besides, 21st century Fortran is a really weird language that doesn't even know what it wants to be when it grows up.

The original #LISP had 7 primitives: \(\texttt{cons}\), \(\texttt{car,}\) \(\texttt{cdr}\), \(\texttt{atom}\), \(\texttt{quote}\), \(\texttt{eq}\), and \(\texttt{cond}\). And the original #Smalltalk syntax could fit on a 5×7 card. That meant a novice could learn the syntax in a matter of minutes, and direct all his efforts to learning how properly to wield the power of that Turing-complete language. This was why, in the 1970s and the 1980s, many college freshmen were taught FP in Scheme (a more modern LISP) and many middle school children were taught OO in Smalltalk. These were surely the best "first" #programming languages.

#FORTRAN and #BASIC were simple, too. FORTRAN, the first high-level language, has been in continuous use since the late 1950s by engineers, who are not keyboard warriors. BASIC was invented in the early 1960s for teaching programming to non-STEM students at Dartmouth. It sired a whole generation of self-taught children in the 1980s.

Compare those to C++, Erlang, Python, Haskell, Java, JavaScript, Scala, Rust, Kotlin, and pretty much every language in popular use today. Most consider Python and JavaScript to be the simplest of modern languages. Yet, they are massive, complex languages. No 10-year-old could teach himself those, nor should he.

The original versions of those classic languages cannot be used to solve modern problems. But they should still be taught to youngsters as their first language. Throwing in the kids' faces a modern enterprise language confuses them and discourages them. Consequently, many novices never attain that state of flow, when the joy of programming gushes forth.

#Simplicity is a virtue. Self-motivated learning is virtuous.