Hacker News new | ask | show | jobs
by triplefox 6223 days ago
The one that always bugged me but seems to be true for most dynamic languages is immutable types being passed by value and everything else passed by reference.
1 comments

For an immutable type, there's no distinction between pass-by-value and pass-by-reference. How would you ever know the difference?
Speed? Not sure if this is actually what the OP was thinking of, but pass-by-value usually implies copying, while pass by reference just involves handing around a pointer.

ie, if you had an enormous immutable value (in Python, a tuple with lots of entries), then in a hypothetical Python implementation which did call-by-value, it might be significantly slower than call-by-reference, on account of having to copy the entire tuple.

But this falls squarely into 'implementation detail' - if you're so inclined, you could implement either CBV or CBR in hundreds of other ways. Certainly from the perspective of time-independent program behaviour you shouldn't be able to tell the difference.