← Back to context Comment by jagged-chisel 11 hours ago Pass-by-value is already a copy. 5 comments jagged-chisel Reply jcparkyn 11 hours ago It's only semantically a pass-by-value, in reality a reference is passed and the data is only copied if needed (i.e. value is mutated while shared). zahlman 10 hours ago So the language has reference semantics, and (per the edit) for every object (like in Python)?(Ah, no, your example elsewhere in the thread suggests that the referred-to structures get implicitly copied all over the place.) jcparkyn 10 hours ago Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated. 2 replies →
jcparkyn 11 hours ago It's only semantically a pass-by-value, in reality a reference is passed and the data is only copied if needed (i.e. value is mutated while shared). zahlman 10 hours ago So the language has reference semantics, and (per the edit) for every object (like in Python)?(Ah, no, your example elsewhere in the thread suggests that the referred-to structures get implicitly copied all over the place.) jcparkyn 10 hours ago Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated. 2 replies →
zahlman 10 hours ago So the language has reference semantics, and (per the edit) for every object (like in Python)?(Ah, no, your example elsewhere in the thread suggests that the referred-to structures get implicitly copied all over the place.) jcparkyn 10 hours ago Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated. 2 replies →
jcparkyn 10 hours ago Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated. 2 replies →
It's only semantically a pass-by-value, in reality a reference is passed and the data is only copied if needed (i.e. value is mutated while shared).
So the language has reference semantics, and (per the edit) for every object (like in Python)?
(Ah, no, your example elsewhere in the thread suggests that the referred-to structures get implicitly copied all over the place.)
Nope, it's value semantics (unlike Python), the references are just an internal optimization. Implicit copies happen when a list/dict with more than one reference is mutated.
2 replies →