Implement pass-by-value semantics for functions