# On using \`=\` vs \`:=\` for assignment

**URL:** <https://discourse.julialang.org/t/on-using-vs-for-assignment/110302>\
**Category:** Offtopic\
**Created:** [February 8, 2024, 3:46pm UTC](https://discourse.julialang.org/t/on-using-vs-for-assignment/110302 "2024-02-08T15:46:21Z")\
**Posts on this page:** 1\
**Showing post:** 73

<div class="post-metadata">

**Author:** ![mnemnion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mnemnion/32/206596_2.png) [@mnemnion](https://discourse.julialang.org/u/mnemnion)\
**Post date:** [February 29, 2024, 7:27pm UTC](https://discourse.julialang.org/t/on-using-vs-for-assignment/110302/73 "2024-02-29T19:27:16Z")

</div>

> [@uniment](#):
>
> Another attractor is that if we wish to add a new keyword sometime later, it can simply be added. For example, maybe someday in the future you want `let dynamic a=1` for dynamically-scoped variables: you could simply decide `dynamic` is a context-dependent keyword now and make it happen.

`something x = y` for all values of `something` other than `global`, `local`, and (top-scope) `const`, is a parse error, so adding `dynamic` or any other keyword there is already possible. `global`/`local`/`const` _could_ be context-dependent rather than lexer keywords. This would involve a token of lookahead, but that’s easy enough. They don’t happen to be, which is also fine, but means that if they became contextual, it wouldn’t invalidate any existing programs, you can’t have `global = 5`, let alone `global global = 5`. But these constructs could certainly be parsed if that was desired. It would be an unusual choice, but I kind of like it.

By contrast, having `let` as a variable modifier would be undecidable in linear time, since `let x = y` begins a `let` block in Julia. You’d need to scan the entire program to count `end` tokens and see if you came up short, for every `let`, which is awful. I understand that you have a solution to this but don’t really care to relitigate that particular disagreement.

---

_[View the full topic](https://discourse.julialang.org/t/on-using-vs-for-assignment/110302)._
