Is Motoko pass-by-value or pass-by-reference?

I would rephrase this. By-value and by-reference are notions of more low-level languages. In Motoko, there is no observable difference, it is an implementation detail.

Instead, some values are mutable. But a mutable value has identity and is never implicitly copied, no matter what you do with it (because copying would in fact create a different value).

See also my reply here.

4 Likes