I have a function, littered with macros, which when I call macroexpand on 
it returns the following Expr:

quote # /home/tlycken/.julia/v0.3/Interpolations/src/linear.jl, line 12: 
    begin
        begin
            ix_1 = ifloor(x_1) 
            fx_1 = x_1 - convert(typeof(x_1),ix_1)
        end
    end # line 13: 
    begin
        ixp_1 = ix_1 + 1
    end # line 14: 
    begin
        $(Expr(:boundscheck, false)) 
        begin
            ret = (one(fx_1) - fx_1) * itp.coefs[ix_1] + fx_1 * itp.coefs[ixp_1]
            $(Expr(:boundscheck, :(Base.pop))) 
        end
    end # line 15:
    ret
end

Now, for my own sanity when I try to reason about this code, it would be 
much easier if I could be sure that the above Expr is equivalent with this 
one (except for the removal of an @inbounds block):

quote # /home/tlycken/.julia/v0.3/Interpolations/src/linear.jl, line 12: 
    ix_1 = ifloor(x_1) 
    fx_1 = x_1 - convert(typeof(x_1),ix_1)
    ixp_1 = ix_1 + 1
    ret = (one(fx_1) - fx_1) * itp.coefs[ix_1] + fx_1 * itp.coefs[ixp_1] # this 
line previously had @inbounds as well
    ret
end

I *think* that the man page on scoping 
<http://julia.readthedocs.org/en/latest/manual/variables-and-scoping/>, and 
specifically the line *“Notably missing from this list are begin blocks 
<http://julia.readthedocs.org/en/latest/manual/control-flow/#man-compound-expressions>,
 
which do not introduce new scope blocks”*, indicate that I’m right, but I’m 
not certain. Could someone confirm this for me? Since I’m not assigning the 
results of the expressions to anything, the implications of begin ... end 
in this context is still a little shady to me.

// T
​

Reply via email to