vak: (Житель планеты Узм)
[personal profile] vak
Фортран доразвился до современного менеджера пакетов: называется fpm. Напоминает утилиту cargo из Rust. Устанавливаем на маке:
$ brew tap fortran-lang/fortran
$ brew install fpm
Создаём простой пример:
$ fpm new first_steps
Появится проект из нескольких файлов:
$ tree first_steps 
first_steps
├── README.md
├── app
│ └── main.f90
├── fpm.toml
├── src
│ └── first_steps.f90
└── test
└── check.f90

4 directories, 5 files
Компилируем и запускаем:
$ cd first_steps
$ fpm run
+ mkdir -p build/dependencies
first_steps.f90 done.
libfirst_steps.a done.
main.f90 done.
first_steps done.
[100%] Project compiled successfully.
Hello, first_steps!

$ fpm test
check.f90 done.
check done.
[100%] Project compiled successfully.
Put some tests in here!
Смотрим содержимое файлов. Современный фортран, поддержка модулей, все дела.
$ cat app/main.f90
program main
use first_steps, only: say_hello
implicit none

call say_hello()
end program main

$ cat src/first_steps.f90
module first_steps
implicit none
private

public :: say_hello
contains
subroutine say_hello
print *, "Hello, first_steps!"
end subroutine say_hello
end module first_steps

$ cat test/check.f90
program check
implicit none

print *, "Put some tests in here!"
end program check

Date: 2023-06-05 20:07 (UTC)
juan_gandhi: (Default)
From: [personal profile] juan_gandhi

Фортран вечен. Если оно в стиле cargo, так это классно. Когда уже скала с джавой сообразят, с кого пример брать.

Date: 2023-06-06 02:42 (UTC)
x86128: (Default)
From: [personal profile] x86128
Еще чуть-чуть и классы с итераторами завезут.

Date: 2023-06-07 03:03 (UTC)
x86128: (Default)
From: [personal profile] x86128
😱😳