# Should I believe this Core.Box()?

**URL:** https://discourse.julialang.org/t/should-i-believe-this-core-box/90263
**Category:** General Usage
**Tags:** corebox
**Created:** [November 14, 2022, 10:21pm UTC](https://discourse.julialang.org/t/should-i-believe-this-core-box/90263 "2022-11-14T22:21:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [November 14, 2022, 10:21pm UTC](https://discourse.julialang.org/t/should-i-believe-this-core-box/90263/1 "2022-11-14T22:21:07Z")

</div>

In a debug session.  
Note that `D3_` becomes instantly a `Core.Box()` but the precedent line, which is virtually equal, gets assigned as expected.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/6/66bf8675cfc436810b2914b6ef68cb11f86b7016.png)

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [November 14, 2022, 10:40pm UTC](https://discourse.julialang.org/t/should-i-believe-this-core-box/90263/2 "2022-11-14T22:40:16Z")

</div>

Nowhere even close to enough information here to say for sure, but I assume this is because you’re rebinding `D3_` in a closure somewhere else.

Observe:

```julia
julia> function foo_maker()
           x = 3 # <---- This will be boxed
           y = 4 # <---- This won't
           function ()
               x = x + y
           end
       end
foo_maker (generic function with 1 method)

julia> @code_typed foo_maker()
CodeInfo(
1 ─ %1 = Core.Box::Type{Core.Box}
│ %2 = %new(%1)::Core.Box
│ Core.setfield!(%2, :contents, 3)::Int64
│ %4 = π (4, Int64)
│ %5 = %new(var"#13#14"{Int64}, %4, %2)::var"#13#14"{Int64}
└── return %5
) => var"#13#14"{Int64}

```

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [November 14, 2022, 10:55pm UTC](https://discourse.julialang.org/t/should-i-believe-this-core-box/90263/3 "2022-11-14T22:55:05Z")

</div>

Thanks for looking. I thought in something like that might be happening and renamed that variable such that it’s only used in [that function](https://github.com/GenericMappingTools/GMT.jl/blob/master/src/statplots.jl#L206). And `@code_typed` has no references to `Core.Box`

```julia
@code_typed boxplot(vvv, separator=true, show=1)
CodeInfo(
1 ─ goto #3 if not false
2 ─ nothing::Nothing
3 ┄ %3 = $(Expr(:foreigncall, :(:jl_alloc_array_1d), Vector{Real}, svec(Any, Int64), 0, :(:ccall), Vector{Real}, 0, 0))::Vector{Real}
└── goto #5 if not false
4 ─ nothing::Nothing
5 ┄ %6 = π (true, Bool)
└── goto #7 if not false
6 ─ nothing::Nothing
7 ┄ %9 = π (0.75, Float64)
└── goto #9 if not false
8 ─ nothing::Nothing
9 ┄ %12 = π (false, Bool)
│ %13 = Base.getfield(@_2, 1)::Bool
│ %14 = Base.getfield(@_2, 2)::Int64
│ %15 = %new(NamedTuple{(:separator, :show), Tuple{Bool, Int64}}, %13, %14)::NamedTuple{(:separator, :show), Tuple{Bool, Int64}}
│ %16 = %new(Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}, %15, (:separator, :show))::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}
│ %17 = invoke GMT.:(var"#boxplot#817")(%3::Vector{Real}, %6::Bool, %9::Float64, %12::Bool, %16::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:separator, :show), Tuple{Bool, Int64}}}, @_3::typeof(boxplot), data::Vector{Vector{Vector{Float64}}})::Any
└── return %17
) => Any

```
