In closure, compile away a step in a calculation internal to some function called in a closure?

I think my question is related to internals…

Core of the question is for a closure like:

X = something 
g = let x = X
    y -> f(x, y) 
end 

Is it currently possible for the Julia compiler, on first method call, to precalculate things within f(x,y) given X ? If so, how can this be achieved (e.g., is there some macro, like @inline, that would do this)? If not, is this something that could be feasibly accomplished in a later version of Julia?