# New scope solution

**URL:** <https://discourse.julialang.org/t/new-scope-solution/16707>\
**Category:** Internals & Design\
**Tags:** proposal\
**Created:** [October 23, 2018, 8:58pm UTC](https://discourse.julialang.org/t/new-scope-solution/16707 "2018-10-23T20:58:16Z")\
**Posts on this page:** 1\
**Showing post:** 181

<div class="post-metadata">

**Author:** ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)\
**Post date:** [January 28, 2019, 10:58pm UTC](https://discourse.julialang.org/t/new-scope-solution/16707/181 "2019-01-28T22:58:14Z")

</div>

> [@StefanKarpinski](#):
>
> It satisfies #2 perfectly: the meaning of code no longer depends on any global state—if you evaluate the same sequence of expressions in the REPL multiple times it means the same thing every time.

We could test your “lemma”:

```julia
julia> if get(ENV, "debug", "0") != "0"
         macro check(a) :(if !$(esc(a)) throw(ErrorException("ups!")) end) end
       else
         macro check(a) end
       end

       t = 4
       for i in 1:2
         @check ispow2(t) # I want to check only in debug phase
         t = 16
       end
       t
4

```

now we could define env variable `ENV["debug"]="1"` and repeat same sequence.

---

_[View the full topic](https://discourse.julialang.org/t/new-scope-solution/16707)._
