Hacker News new | ask | show | jobs
by eptcyka 1294 days ago
Sure, you can't have the same code for Python, for instance, even if it was using objects, but you can have the same effect using a hack by copying the __dict__ from one object to another. However, you are still passing the object to a function by reference because the function can mutate the object and the object that the callee passed will also be mutated the same way, i.e. mutable objects are passed by reference, and values are passed as values. Which is how python, javascript, Java and the rest work. Obviously, you don't get to change what the reference is pointing to in most of these languages, but you can change the value that is being pointed to.