Ok thanks. I guess the heart of the question is overcoming Julia's builtin pass-by-reference behavior. I would be fine using an explicit copy function, but is there any way I can avoid defining a copy function for all my types, which would be annoying?
OK, it seems that deepcopy corresponds better to C++ copy semantics, and apparently julia provides a default implementation of deepcopy for user types.