# Are integers immutable and are they acceptable as keys in

**URL:** <https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816>\
**Category:** General Usage\
**Created:** [March 9, 2021, 3:50pm UTC](https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816 "2021-03-09T15:50:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon60034542](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Post date:** [March 9, 2021, 3:50pm UTC](https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816/1 "2021-03-09T15:50:30Z")

</div>

I was reading about [Mutable Composite Types](https://docs.julialang.org/en/v1/manual/types/#Mutable-Composite-Types), and it says:

> In particular, this means that small enough immutable values like integers and floats are typically passed to functions in registers (or stack allocated).

Are integers really immutable? Can they safely be used as keys in a dictionary?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 9, 2021, 3:57pm UTC](https://discourse.julialang.org/t/are-integers-immutable-and-are-they-acceptable-as-keys-in/56816/2 "2021-03-09T15:57:28Z")

</div>

> [@anon60034542](#):
>
> Are integers really immutable? Can they safely be used as keys in a dictionary?

Yes and yes (assuming you mean some concrete type like `Int` or `Int64` or `Int32`). In fact, `Int`s are “bits” types, which is an even stricter subset of immutability:

```julia
help?> isbitstype
search: isbitstype

  isbitstype(T)

  Return true if type T is a "plain data" type, meaning it is immutable and contains no references to other values,
  only primitive types and other isbitstype types. 

```

```julia
julia> isbitstype(Int)
true

```
