Refer to variables by a different name

I’m not sure I fully understand your question, as you ask about variables but your examples are about the names of fields in a struct.

Your second example should work fine if you use = for assignment

function myfun(w::Workspace, x)
    elapsed_time = w.fN_1
    ....
end

assignment doesn’t copy in Julia so this doesn’t cost you anything.

When you ask about “refer[ing] to a variable by a different name in some local scope” that sounds like a let block:

julia> x = 5
5

julia> let a = x
           println(a)
       end
5