Julia Editions - introducing language modifications without breaking code

Hi all,

The stability of Julia 1.0 means we cannot introduce breaking changes, and for a good reason. Nevertheless sometimes it would be nice to be able to introduce such changes without braking code. Surprisingly, for many cases this is possible. The Rust language alleviates this problem with “Rust Editions”, the current being “Rust 2018”.

Let me just propose (by example) the following “Julia Editions” allowing some changes to the “Julia v1.0” language that otherwise would break old code:

  • Julia editions would be all opt-it
  • Suppose module A declares “Julia Edition 2020”
  • now module A can use “rad_to_deg” instead of “rad2deg”
  • module A can also call module B which declared “Julia Edition 2019”
  • module B can only use “rad2deg” because “rad_to_deg” is an edition 2020 feature
  • but module B has nice scoping of variables because it was fixed in edition 2019
  • module A and B can call into module C, which does not declare any edition
  • module C uses just “Julia v1.0”

so. The idea is that while editions contain otherwise breaking changes, Julia v1.0 still knows how to support/run/compile all the editions, and the editions are opt-in. This way the language development can advance more freely and not in huge steps v1, v2. Instead we sould have small steps: j1ed2019, j1ed2020, j12021, etc.

when Julia is changed in such an extreme way that it cannot be compatible with v1 code, then it has to be versiond as Julia V2.0, and the editions continue from there

Thoughts?

There are very few (almost none) that you can support that can’t be done with a package.

1 Like

And finally found it Suggestion: Require a Julia Header with Version in Shebang · Issue #29640 · JuliaLang/julia · GitHub.

In short, doing it will actually makes it harder to introduce new breaking changes. In fact, it encourage introducing breaking changes with less careful planing and make every single of them much harder to actually implement. Both are bad.

Running old code is a concern that should be addressed differently and mixing old and new code will either be trivial to fix (so no need to use anything like this) or impossible (so something like this won’t help at all).

3 Likes