# Julia 1.8 vs Julia 1.9: Isn't this a breaking change?

**URL:** <https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785>\
**Category:** General Usage\
**Created:** [March 9, 2023, 6:50am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785 "2023-03-09T06:50:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![uje](https://avatars.discourse-cdn.com/v4/letter/u/5f9b8f/32.png) [@uje](https://discourse.julialang.org/u/uje)\
**Post date:** [March 9, 2023, 6:50am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/1 "2023-03-09T06:50:01Z")

</div>

Isn’t the changes below between the two different versions supposed to be “considered” as breaking?

**JULIA 1.8**  
Doc says:

> Note that while variable bindings can be read externally, they can only be changed within the module to which they belong. As an escape hatch, you can always evaluate code inside that module to modify a variable; this guarantees, in particular, that module bindings cannot be modified externally by code that never calls `eval` .

This happens:

```julia
julia> module A
           a = 1 # a global in A's scope
       end;

julia> A.a
1

julia> module E
           import ..A # make module A available
           A.a = 2 # throws below error
       end;
ERROR: cannot assign variables in other modules

```

**JULIA 1.9**  
Doc still says:

> Note that while variable bindings can be read externally, they can only be changed within the module to which they belong. As an escape hatch, you can always evaluate code inside that module to modify a variable; this guarantees, in particular, that module bindings cannot be modified externally by code that never calls `eval` .

But this happens:

```julia
julia> module A
           a = 1 # a global in A's scope
       end;

julia> A.a
1

julia> module E
           import ..A # make module A available
           A.a = 2 # surprisingly, this throws no error
       end;

julia> A.a
2

```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 9, 2023, 7:02am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/2 "2023-03-09T07:02:28Z")

</div>

> [@uje](#):
>
> Isn’t the changes below between the two different versions supposed to be “considered” as breaking?

No, making non-working code work isn’t considered breaking, that’s quite the opposite.

---

<div class="post-metadata">

**Author:** ![uje](https://avatars.discourse-cdn.com/v4/letter/u/5f9b8f/32.png) [@uje](https://discourse.julialang.org/u/uje)\
**Post date:** [March 9, 2023, 7:04am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/3 "2023-03-09T07:04:08Z")

</div>

I honestly do not get your explanation. Can you please make it easy to understand?

Will I be correct if I assume because all module definitions with `module` implicitly contain definitions of `eval` and `include`, so module `E` can make such a change to `A`?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [March 9, 2023, 7:08am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/4 "2023-03-09T07:08:33Z")

</div>

You’re showing that a piece of code used to throw an error, so no one is probably using it, because, well, that’s just throwing an error. Now the same piece of code does something useful. That’s hardly breaking anyone’s workflow since no one was likely using a non-working piece of code.

---

<div class="post-metadata">

**Author:** ![uje](https://avatars.discourse-cdn.com/v4/letter/u/5f9b8f/32.png) [@uje](https://discourse.julialang.org/u/uje)\
**Post date:** [March 9, 2023, 7:12am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/5 "2023-03-09T07:12:38Z")

</div>

My words on “breaking” might be incorrect, which would be a result of me not understanding what this part of the doc means exactly:

> Note that while variable bindings can be read externally, they can only be changed within the module to which they belong. As an escape hatch, you can always evaluate code inside that module to modify a variable; **this guarantees, in particular, that module bindings cannot be modified externally by code that never calls `eval`**.

The bolded part is where my confusion is probably coming from: does it mean **implicitly calls `eval`** or **explicitly calls `eval`**? Because I took that statement to mean “code that never calls `eval` **explicitly** ”.

---

<div class="post-metadata">

**Author:** ![albheim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albheim/32/34660_2.png) [@albheim](https://discourse.julialang.org/u/albheim)\
**Post date:** [March 9, 2023, 7:49am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/6 "2023-03-09T07:49:07Z")

</div>

I interpret it similar to you in that the documentation seems to still claim this should not work, though I have to agree with Mose in that it is unlikely to break any code since it errored before and I don’t see any reason to prefer the 1.8 behavior over the 1.9.

In the 1.9 documentation they removed the part

```julia
julia> module E
           import ..A # make module A available
           A.a = 2 # throws below error
       end;
ERROR: cannot assign variables in other modules

```

of the example, which seems to reflect that this is now expected to work, though I feel like the sentence you brought up could probably also be updated in some way to reflect this change.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [March 9, 2023, 7:49am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/7 "2023-03-09T07:49:54Z")

</div>

As far as I understand it is not a breaking change, since one was not able to write like this before in the modules - therefore no-one has a bug related to this.

Now that it is possible, it is a “change”. For better or worse depends on who you ask.

Kind regards

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [March 9, 2023, 8:43am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/8 "2023-03-09T08:43:57Z")

</div>

Looks like the documentation is just not updated after [JuliaLang/julia#44231](https://github.com/JuliaLang/julia/pull/44231).

---

<div class="post-metadata">

**Author:** ![uje](https://avatars.discourse-cdn.com/v4/letter/u/5f9b8f/32.png) [@uje](https://discourse.julialang.org/u/uje)\
**Post date:** [March 9, 2023, 8:49am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/9 "2023-03-09T08:49:54Z")

</div>

I would love to update it, but seems I’m still not clear on the direction, so maybe someone who understands should.

For those who say it’s not breaking, well that is true in the real technical sense of what “breaking” is. But this not being possible in Julia 1.8, has led one into teaching and writing code the other way, something that could have been easy to do with the now Julia 1.9 behaviour: that was what I meant by “breaking”, so moderators can change the article title to what it best represents.

---

<div class="post-metadata">

**Author:** ![uje](https://avatars.discourse-cdn.com/v4/letter/u/5f9b8f/32.png) [@uje](https://discourse.julialang.org/u/uje)\
**Post date:** [March 9, 2023, 9:00am UTC](https://discourse.julialang.org/t/julia-1-8-vs-julia-1-9-isnt-this-a-breaking-change/95785/10 "2023-03-09T09:00:48Z")

</div>

I just thought the `eval` was a thing to module as I explained above with `module`, but it seems as the doc points out in [NEWS.md](https://github.com/JuliaLang/julia/blob/v1.9.0-rc1/NEWS.md), modules can be modified anywhere. As an example:

```julia
julia> module A

       a = 1

       end
Main.A

julia> A.a
1

julia> function modify(A::Module, x)
           A.a = x
       end;

julia> modify(A, 10);

julia> A.a
10

```

So the line on the doc which says:

> Note that while variable bindings can be read externally, they can only be changed within the module to which they belong. As an escape hatch, you can always evaluate code inside that module to modify a variable; this guarantees, in particular, that module bindings cannot be modified externally by code that never calls `eval` .

from what I understand, should be removed altogether.

Moreover, somehow the doc should also point just as is does under the section [modules](https://docs.julialang.org/en/v1.9.0-rc1/manual/modules/#Qualified-names):

> Within a module, a variable name can be “reserved” without assigning to it by declaring it as `global x` . This prevents name conflicts for globals initialized after load time. The syntax `M.x = y` does not work to assign a global in another module; global assignment is always module-local.

Showing an example:

```julia
julia> module A

       global a

       a = 1

       end
Main.A

julia> A.a
1

julia> function modify(A::Module, x)
           A.a = x
       end;

julia> modify(A, a);
ERROR: UndefVarError: `a` not defined

```
