# Idea for setting both mutables and immutables without allocation

**URL:** <https://discourse.julialang.org/t/idea-for-setting-both-mutables-and-immutables-without-allocation/1318>\
**Category:** Internals & Design\
**Tags:** proposal\
**Created:** [January 6, 2017, 5:31am UTC](https://discourse.julialang.org/t/idea-for-setting-both-mutables-and-immutables-without-allocation/1318 "2017-01-06T05:31:55Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 6, 2017, 6:08am UTC](https://discourse.julialang.org/t/idea-for-setting-both-mutables-and-immutables-without-allocation/1318/2 "2017-01-06T06:08:25Z")

</div>

Yes, this sounds really good. I recently noted how DifferentialEquations.jl has two implementations for each method for this very reason:

> [@What exactly is an abstract array? (Deciding how to dispatch)](https://discourse.julialang.org/t/what-exactly-is-an-abstract-array-deciding-how-to-dispatch/1256):
>
> I am trying to find out what the going definition for an AbstractArray is in order to properly choose how to dispatch. As usual, this is best understood by an example. Let’s look at two different ways of writing “the same code”. for i in number\_of\_iterations du = f(t,u) u += dt\*du t += dt end # Make a cache for du for i in number\_of\_iterations f!(t,u,du) # update `du` inplace u .+= dt.\*du t += dt end (Yes, for those who know differential equations, this is the Euler method) If on…

If the `:=` syntax could really work, it would be a major win for packages which provide performant yet general code.

---

_[View the full topic](https://discourse.julialang.org/t/idea-for-setting-both-mutables-and-immutables-without-allocation/1318)._
