# Explicit denotation of variability and immutability

**URL:** <https://discourse.julialang.org/t/explicit-denotation-of-variability-and-immutability/8686>\
**Category:** Internals & Design\
**Tags:** proposal\
**Created:** [January 30, 2018, 10:16am UTC](https://discourse.julialang.org/t/explicit-denotation-of-variability-and-immutability/8686 "2018-01-30T10:16:36Z")\
**Posts on this page:** 1\
**Showing post:** 99

<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 5, 2018, 7:59pm UTC](https://discourse.julialang.org/t/explicit-denotation-of-variability-and-immutability/8686/99 "2018-11-05T19:59:21Z")

</div>

> [@SepandMeenu](#):
>
> I propose _explicit_ **syntactical** safeguards to denote programmer’s intention to **mutate values or bindings** (mutations of the state) in _any_ scope.

One useful but much simpler change compared to what the OP suggests, is to have a different syntactical notation for _defining_ vs _changing_ a binding. For ex, keep `=` for defining, and introduce `:=` or `=:` (or other) for changing the binding of the previously defined variable (re-assignment).

I think when we program we already have this different intent in mind (“I’m going to define this to be…” , “I’m going to change that var to…”), so it will not be any mental cost to actually convey that intent when we write the code.  
So it’s a low-hanging fruit that I think most dynamic or scripting langs don’t collect.  
I suspect doing so, can result in compiler being able to catch more errors, and perhaps optimize the code better, and perhaps also give more options to solve the scope problem (as this [github reply](https://github.com/JuliaLang/julia/issues/28789#issuecomment-423346801) by @jeff.bezanson ).

I guess it could be introduced at first as optional, and if most agree, then in future mandatory.

EDIT: I found that this(or essentially this) idea was also proposed, independently, by @Balance  
,and with more background details, [here](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894/201) , [here](https://discourse.julialang.org/t/another-possible-solution-to-the-global-scope-debacle/15894/214)

---

_[View the full topic](https://discourse.julialang.org/t/explicit-denotation-of-variability-and-immutability/8686)._
