# Assignment and argument passing semantics

**URL:** <https://discourse.julialang.org/t/assignment-and-argument-passing-semantics/17034>\
**Category:** Offtopic\
**Created:** [November 1, 2018, 3:45am UTC](https://discourse.julialang.org/t/assignment-and-argument-passing-semantics/17034 "2018-11-01T03:45:19Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Vic](https://avatars.discourse-cdn.com/v4/letter/v/9e8a1a/32.png) [@Vic](https://discourse.julialang.org/u/Vic)\
**Post date:** [November 1, 2018, 2:44pm UTC](https://discourse.julialang.org/t/assignment-and-argument-passing-semantics/17034/7 "2018-11-01T14:44:58Z")

</div>

I don’t understand what kind of concept of reference is that, if “the content is the reference”. And I don’t mean here whether the 2 immutables are at same address in memory or not – I got that, thanks to you. (Same for mutables).

I mean, in case of mutables, “reference” seems to be a sort of an ID for the object. Even if the object is mutated, the reference stays the same, hence it’s still “same” object; while the contents of the object obviously change.  
Now if you say that “content” is the reference – I guess you mean that’s only true for immutables – that breaks the concept of “reference” I describe above.

Also, it seems to break this [mental model](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840/30) described in that long thread.  
(And it’s _mental_ model,so no worry I don’t interpret it literally )

EDIT: when I said

> [@Vic](#):
>
> For the sake of ease of learning/understanding, I wish Julia offered a way to check the “reference” of even immutable objects.

I meant that, for mutable objects, we have:  
`pointer_from_objref(x)`  
to check the “reference” of the object (correct me if that’s _not_ the reference talked about in this post)  
While for immutables, we don’t have such a thing.

MORE TO THE POINT:  
Suppose `x = [0 0]`  
And suppose we add to Julia language a special keyword to make this mutable object impossible to mutate in current scope, but still otherwise stay array, like:  
`immut x`  
Then I will still be able to check and confirm its unique reference with `pointer_from_objref(x)` , and still the concept of “reference” as ID holds.  
However, now this `x` by all purposes would behave as a immutable object!

That’s whyI wish we had for immutables, a way to check and ID to confirm uniqueness, so that the semantics would seem more consistent (and easier to understand)

---

_[View the full topic](https://discourse.julialang.org/t/assignment-and-argument-passing-semantics/17034)._
