# Another possible solution to the global scope debacle

**URL:** <https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894>\
**Category:** Internals & Design\
**Created:** [October 4, 2018, 6:14pm UTC](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894 "2018-10-04T18:14:07Z")\
**Posts on this page:** 1\
**Showing post:** 61

<div class="post-metadata">

**Author:** ![swissr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swissr/32/208_2.png) [@swissr](https://discourse.julialang.org/u/swissr)\
**Post date:** [October 5, 2018, 10:28am UTC](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894/61 "2018-10-05T10:28:54Z")

</div>

Would it be possible to just re-introduce the warning/error messages in the REPL but otherwise keep the new behaviour from [#19324](https://github.com/JuliaLang/julia/pull/19324)?

In this way, the examples ([IanNZ / 28789)](https://github.com/JuliaLang/julia/issues/28789) loose their gravity as the error/warning message just tells me what to do, i.e. prepend the variable with `global`. The silent failure gives a warning, the ‘real’ failure an error, for example:

```julia
julia> for i in 1:2
         beforefor = false
       end
┌ Warning: `implicit assignment to global variable `beforefor``.
│ Use `global beforefor` instead.
└

julia> for file in list_of_files
         # fake read file
         lines_in_file = 5
         total_lines += lines_in_file
       end
┌ Error: `implicit assignment to global variable `total_lines``.
│ Use `global total_lines` instead.
└

```

I’m not sure I like (yet?) the need to write `global` at some places but on the other hand it seems a coherent rule to access global variables and loosing the hard/soft scope distinction was nice (this distinction has also been criticized). But more importantly, I think the current behaviour has been choosen and I don’t hope that there is now a rush to change it again (before 2.0 and after careful consideration)!

---

_[View the full topic](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894)._
