# Potential compile bug related to keyword arguments and variable scope in 0.5

**URL:** https://discourse.julialang.org/t/potential-compile-bug-related-to-keyword-arguments-and-variable-scope-in-0-5/1506
**Category:** General Usage
**Created:** [January 16, 2017, 9:33am UTC](https://discourse.julialang.org/t/potential-compile-bug-related-to-keyword-arguments-and-variable-scope-in-0-5/1506 "2017-01-16T09:33:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lwabeke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwabeke/32/4005_2.png) [@lwabeke](https://discourse.julialang.org/u/lwabeke)
#### Post date: [January 16, 2017, 9:33am UTC](https://discourse.julialang.org/t/potential-compile-bug-related-to-keyword-arguments-and-variable-scope-in-0-5/1506/1 "2017-01-16T09:33:52Z")

</div>

Hi

I encountered a bug and initially thought it was limited to the Plotlyjs package ([https://github.com/sglyon/PlotlyJS.jl/issues/106](https://github.com/sglyon/PlotlyJS.jl/issues/106)), but as @sglyon showed it seems to be a more general Julia problem.

From my understanding it seems that when using variables from an outer scope with functions using keyword arguments.

I haven’t tested in a version of Julia other than listed in my original issue.

Suggested next steps on this?

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [January 16, 2017, 12:38pm UTC](https://discourse.julialang.org/t/potential-compile-bug-related-to-keyword-arguments-and-variable-scope-in-0-5/1506/2 "2017-01-16T12:38:57Z")

</div>

It works in 0.4, tested with a slight adaption of @sglyon’s example:

```julia
f(;kwargs...) = Dict(kwargs)
let
    v = rand(5)
    global g # in 0.4 this syntax is needed
    function g()
        f(myvar=v)
    end
end
@show g() # errors in 0.5 and 0.6 but not 0.4

```

This seems like a regression to me. If not a regression, it would need at least a better error message. Unless there is other feedback here, please file an issue.
