# Julia: Fast as Fortran, Beautiful as Python

**URL:** <https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405>\
**Category:** Uncategorized\
**Created:** [June 20, 2021, 6:21pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405 "2021-06-20T18:21:13Z")\
**Posts on this page:** 20\
**Page:** 9

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 9, 2022, 10:20pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/172 "2022-11-09T22:20:58Z")

</div>

@meow464 let’s do that. What exactly is required to get a reproducible binary?

---

<div class="post-metadata">

**Author:** ![meow464](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/meow464/32/1987_2.png) [@meow464](https://fortran-lang.discourse.group/u/meow464)\
**Post date:** [November 9, 2022, 10:28pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/173 "2022-11-09T22:28:02Z")

</div>

@certik There are no hard rules, just anything not deterministic or system dependent.

File paths and timestamps are two obvious things. If the compilation process is prallalelized all outputs would have to be written in the same order, for example all object files should be added in the same order to the .a. I know there are some linker aspects one should be aware of but not sure what.  
Having Fpm definitely helps, makes it easy to download dependencies at specific commits.

Debian and golang are two good places to look. IIRC golang has reproducible binaries by default.

But that’s an idea for the future. Maybe next year I will give it a try.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 9, 2022, 10:43pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/174 "2022-11-09T22:43:53Z")

</div>

LFortran default mode is to compile everything into ASR first, and only compile via LLVM or other backends once the main program is asked to be compiled. So it seems using fpm to get all the dependencies, then get one ASR out of everything, and then one compilation should do the trick. The ASR to binary compilation will depend on LLVM version, but we could also use some of our other backends like WebAssembly → x86, and control the output more, but it would then depend on LFortran’s version.

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [November 9, 2022, 10:44pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/175 "2022-11-09T22:44:35Z")

</div>

> [@certik](#):
>
> What exactly is required to get a reproducible binary?

Honestly fpm is the place where you would enable this. You need to ensure you compile with

1. Exactly the same versions of all dependencies
2. In exactly the same order,
3. With exactly the same version of the compiler

I believe Haskell’s stack build system boasts being able to do this.

---

<div class="post-metadata">

**Author:** ![semarie](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/semarie/32/2247_2.png) [@semarie](https://fortran-lang.discourse.group/u/semarie)\
**Post date:** [November 10, 2022, 6:10am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/176 "2022-11-10T06:10:47Z")

</div>

Just a global notice about reproducible build (which might not apply properly to context of usual Fortran usage): having reproductible binary isn’t necessary a good thing for all cases, specially in security context: having diversity in binary make functions position in the binary random, and so adds some complexity for attacker.

With reproductible binary, one leak of exact function offset in memory, permits to know exact position of all functions (as relative position of functions is known due to reproductible build).

---

<div class="post-metadata">

**Author:** ![Carltoffel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/carltoffel/32/1680_2.png) [@Carltoffel](https://fortran-lang.discourse.group/u/Carltoffel)\
**Post date:** [November 10, 2022, 8:13am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/177 "2022-11-10T08:13:18Z")

</div>

> [@certik](#):
>
> What exactly is required to get a reproducible binary?

I’m not familiar with reproducible build systems, but my colleague always stresses the importance of reproducibility. He works with [NixOS](https://nixos.org/) which has reproducibility as its main feature. Perhaps you would like to check this out.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 10, 2022, 4:24pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/178 "2022-11-10T16:24:08Z")

</div>

Yes, I am familiar with NixOS. It uses hashes to identify dependencies uniquely. Julia Pkg, Spack, etc. all do that. Fpm doesn’t do it yet, but it is designed in such a way so that it could. It behaves that way.

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [November 10, 2022, 6:23pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/179 "2022-11-10T18:23:04Z")

</div>

I glanced through the paper, hoping to find a section that addresses the perceived limitations and weaknesses of the Julia language (e.g., [Why I no longer recommend Julia](https://yuri.is/not-julia/)) – particularly the reliability issues of the language, or proposes a plan to address them. Alas, no discussion. Maybe I missed it.

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [November 11, 2022, 10:20am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/180 "2022-11-11T10:20:33Z")

</div>

> **[Discussion on "Why I no longer recommend Julia" by Yuri Vishnevsky](https://discourse.julialang.org/t/discussion-on-why-i-no-longer-recommend-julia-by-yuri-vishnevsky/81151/62)**
>
> I have been fortunate to have recently moved to a Software Engineer role from being a research academic while being employed at an institution willing to invest in open source infrastructure. We recently launched an Open Science Software Initiative:...

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [November 11, 2022, 11:08am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/181 "2022-11-11T11:08:27Z")

</div>

> [@shahmoradi](#):
>
> I glanced through the paper, hoping to find a section that addresses the perceived limitations and weaknesses of the Julia language (e.g., [Why I no longer recommend Julia](https://yuri.is/not-julia/)) – particularly the reliability issues of the language, or proposes a plan to address them. Alas, no discussion. Maybe I missed it.

I have not yet read the paper in details but you seem right. Some would say they are “overly enthusiastic”:  
[https://twitter.com/juanluisback/status/1590716977365934081](https://twitter.com/juanluisback/status/1590716977365934081)

Probably enthusiasm is both a flaw of youth and a strength. I think Backus’ team was in the same spirit during the initial FORTRAN project. But it reminds me the title of a discussion between K. Lorenz and K. Popper, “The Future is Open” (Die Zukunft ist offen):

> **[The Future Is Open by Karl R. Popper](https://www.librarything.com/work/1944539)**
>
> Click to read more about The Future Is Open by Karl R. Popper. LibraryThing is a cataloging and social networking site for booklovers

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [November 11, 2022, 11:22am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/182 "2022-11-11T11:22:33Z")

</div>

A quote for every programming community:

> **[Karl Popper Quote](https://libquotes.com/karl-popper/quote/lbi9x2o)**
>
> Optimism is a duty. The future is open. It is not predetermined. No one can predict it, except by chance. We all contribute to determining it by what we do. We are all equally responsible for its success.

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [November 11, 2022, 3:55pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/183 "2022-11-11T15:55:39Z")

</div>

> <https://twitter.com/elucian_moise/status/1588629819927171072>

"There are yet many Universities teaching Fortran! But I have study modern Fortran in details recently and I’m honestly not impressed! "

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [November 12, 2022, 10:38pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/184 "2022-11-12T22:38:05Z")

</div>

Why was he not impressed ? What would impress him ? What has impressed him in the past and why ?

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [November 12, 2022, 11:03pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/185 "2022-11-12T23:03:42Z")

</div>

If you or someone with a similar curiosity who also uses Twitter (I don’t, otherwise I would ask) may want to inquire directly with that poster on that platform, the bio of that poster suggests someone is generally interested in learning programming languages and more importantly, teaching the languages to a diverse audience who might otherwise find programming difficult or even be scared of it.

---

<div class="post-metadata">

**Author:** ![Aurelius\_Nero](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@Aurelius\_Nero](https://fortran-lang.discourse.group/u/Aurelius_Nero)\
**Post date:** [November 12, 2022, 11:10pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/186 "2022-11-12T23:10:56Z")

</div>

I would love to, sadly you and I are both in the same boat. ☹

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [November 12, 2022, 11:41pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/187 "2022-11-12T23:41:16Z")

</div>

Ok, I just opened up a Twitter account and posted a direct inquiry with that poster. I noticed @everythingfunctional had done the same.

---

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [November 13, 2022, 2:46am UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/188 "2022-11-13T02:46:59Z")

</div>

Yep, I haven’t heard anything back though.

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [November 13, 2022, 1:53pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/189 "2022-11-13T13:53:20Z")

</div>

He’s been posting very brief snippets for a while (looking at his tweet history) and commenting with generic frustration. But never really going deeper on why and how.

Example: [https://twitter.com/elucian\_moise/status/1589764978760101889?t=1pk8qvT3HotvMomi6UWQjA&s=19](https://twitter.com/elucian_moise/status/1589764978760101889?t=1pk8qvT3HotvMomi6UWQjA&s=19)

 ![IMG_20221113_145411](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/d/d2587ef76991a5b151dd681d0196ae437d89a503.jpeg)

---

<div class="post-metadata">

**Author:** ![rgba](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/rgba/32/2115_2.png) [@rgba](https://fortran-lang.discourse.group/u/rgba)\
**Post date:** [November 13, 2022, 2:11pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/190 "2022-11-13T14:11:34Z")

</div>

Mmm here he’s complaining that Fortran does not have “switch” but then in the example he’s using `select case`.

> <https://twitter.com/elucian_moise/status/1586180286362144768?t=rUgYAP2OT7qdmSJwX5Y34w&s=19>

Elsewhere he was complaining about `parameter` to mean “constant”. Is he arguing about naming conventions?

Anyway I’m tired of scrolling so I’ll stop here. 🙂

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [November 13, 2022, 2:58pm UTC](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405/191 "2022-11-13T14:58:33Z")

</div>

> [@rgba](#):
>
> Elsewhere he was complaining about `parameter` to mean “constant”. Is he arguing about naming conventions?

I looked into this one. It appears to be a misconception about the possible meanings of the word _parameter_. I guess the person is more familiar with languages such as C, D, Nim, & Julia, which use the [`const`](https://en.wikipedia.org/wiki/Const_(computer_programming)) keyword. We could equally argue, that the [`final`](https://en.wikipedia.org/wiki/Final_(Java)) keyword in Java, or the `readonly` in C#, don’t make sense to a Fortran programmer.

A few dictionaries I checked list _constant_ as a synonym for _parameter_. But _parameter_ can also mean a characteristic of something, i.e. “the parameters of the atmosphere, density, temperature”, which would normally be interpreted as dependent variables. In some sentences it is also used for _limits/boundaries_ of something. I guess the Fortran usage originates from independent variable, i.e. a value which determines a particular function from a family of functions. E.g. we could have a quadratic f(x) = x^2 + px + q, where p and q are the parameters. Using a Fortran 77 statement function (and implicit typing ⚠) this may have been written as:

```fortran
      PARAMETER(P=-4.,Q=2.)
      F(X) = X**2 + P*X + Q
      READ *, X
      Y = F(X)

```

Or the volume of a sphere could have been calculated as:

```fortran
       PARAMETER ( PI=3.14159 ) 
       REAL RADIUS, VOLUME      
       SPHERE ( R ) = 4.0 * PI * (R**3) / 3.0 
       READ *, RADIUS 
       VOLUME = SPHERE( RADIUS ) 

```

I watched recently a [talk](https://www.youtube.com/watch?v=lKXe3HUG2l4&t=763s) by [Joe Armstrong](https://en.wikipedia.org/wiki/Joe_Armstrong_(programmer)), a co-designer of the [Erlang](https://en.wikipedia.org/wiki/Erlang_(programming_language)) programming language. In the talk he highlights that in 1985, most programmers knew sh, make, and C, and hence had a common language. Some might have also known Assembly, COBOL, or FORTRAN. Nowadays with over 2000 programming languages, programmers don’t have a common language, and can’t talk with each other. Not to mention the differences in build tools…

[Previous page](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405.md?page=8)

[Next page](https://fortran-lang.discourse.group/t/julia-fast-as-fortran-beautiful-as-python/1405.md?page=10)
