# Variable binding: (re-) assignment, argument passing, \`let\`, scope

**URL:** <https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840>\
**Category:** New to Julia\
**Tags:** documentation\
**Created:** [October 26, 2018, 11:19pm UTC](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840 "2018-10-26T23:19:03Z")\
**Posts on this page:** 1\
**Showing post:** 37

<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:** [October 30, 2018, 5:30pm UTC](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840/37 "2018-10-30T17:30:03Z")

</div>

> [@yuyichao](#):
>
> Still wrong.[…]

You are right – and not just based on the recent replies you wrote, but I was simply making ~~no sense~~ not much sense with that particular region of reply: “Then you misunderstood what I believe true and what not…” [here](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840/20) , I’ve striken it out and edited – please read if you want.

Perhaps because of that, my concept of “memory location” for values seemed inconsistent to you. Other than that, I don’t see where I ever changed my definition for it.

> You started as `x = 2` in REPL overwriting a “value-location” with 2, which is simply not something that ever happen in this case.

True (or…really? ever? ) but let’s not dig into what I wrote so many replies ago 🙂 . I’ve learnt many things by now, I don’t believe everything I wrote there anymore.

I think you’ll be pleased to see how my interpretations read now: [Variable binding: (re-) assignment, argument passing, `let`, scope](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840)

> [@yuyichao](#):
>
> That due respect should include considering why something that seems wrong could be right rather than straight denying the official definition.

Believe me, I did a lot of consideration (all these replies took me an incredible amount of time). If you noticed, I actually tried to quote and follow official definitions from documentation whenever I could.  
You often did not give reference, did not explain in detail, and I did not know you: why would I take your words as “official definition”?  
(And such situations is when one should question and not believe blindly)

> [@yuyichao](#):
>
> > So I can see now what @yuyichao might have meant when he was saying that an instruction like `x=100` _may or may not_ result in storing 100 at some place in memory. It really depends on the other instructions next to `x=100` , given as a block or not, and context.
> 
> That is exactly what I said.
> 
> ![](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/40/20_1.png) yuyichao:
> 
> > The simplest example is that if you write `x = 1; x = 2;` in a local scope I can guarantee you that the `1` will not appear in the compiled code.

Indeed. I was actually not thinking at all about compiler optimizations. I had in mind compiler executing my instructions word for word, as if one at a time in REPL.  
Also, I had taken (long ago) an intro C course. There, teacher told us that re-assignment literally meant re-writing the memory location with a diff value, and never told us that “it depends, may or may not” (so he lied to me then 🙂 because he didn’t mention possible optimizations )

> The only way I can think of (and tried) to help you resolve these issues is to avoid talking about your "value-location"s at all. If you want to keep it, I really have no idea how to build a consistent picture with that.

I see how you wanted to protect me against extra confusion( Edit: thanks for that intention). But with a person like me, just “don’t” doesn’t work well… I needed to know “Why”… I think now I understand.

---

_[View the full topic](https://discourse.julialang.org/t/variable-binding-re-assignment-argument-passing-let-scope/16840)._
