# ImmutableDict documentation

**URL:** <https://discourse.julialang.org/t/immutabledict-documentation/128033>\
**Category:** New to Julia\
**Created:** [April 14, 2025, 12:51am UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033 "2025-04-14T00:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [April 14, 2025, 12:51am UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/1 "2025-04-14T00:51:35Z")

</div>

After stumbling through using an ImmutableDict, I’d like to submit some documentation for the type. Is there a procedure for this?

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [April 14, 2025, 6:41am UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/2 "2025-04-14T06:41:16Z")

</div>

Hi,  
the current official documentation is visible at

> **[Collections and Data Structures · The Julia Language](https://docs.julialang.org/en/v1/base/collections/#Base.ImmutableDict)**
>
> Documentation for The Julia Language.

(or with `? ImmutableDict` in REPL)  
If you hover over the bottom right you get a link to its source code

> <https://github.com/JuliaLang/julia/blob/8561cc3d68d3551a5728b40f782c244834fd3348/base/dict.jl#L778-L793>

So in order to improve that you have to fork the Julia repository, improve the code in that file and open a [pull request](https://github.com/JuliaLang/julia/pulls) to the Julia repo.

Usually it is good to have a bit of a discussion maybe even before you start working. What would you like to improve?

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [April 14, 2025, 6:12pm UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/3 "2025-04-14T18:12:18Z")

</div>

Thanks. Here’s what I wrote after my stumbling. What do you think?

`ImmutableDict` is a dictionary implemented as an immutable linked  
list. It’s intended for small mappings with a few entries, a short  
list of keywords perhaps; when the overhead of accessing a hash table is  
higher than that of a linear search of a linked list. Because it’s an  
unusual type, `ImmutableDict` is `public` rather than `export`; to  
access it one must write `Base.ImmutableDict`

To create an `ImmutableDict` use

```
imdict = Base.ImmutableDict(key=>value, key=>value, ...)

```

This will put the first elements in the list and also define the type  
of the list elements; the returned value will be the head of the  
list. To add to the list use

```
imdict = Base.ImmutableDict(imdict, key=>value, key=>value, ...)

```

Pairs cannot be removed from the list, but they can be shadowed by  
adding an additional pair with a duplicate key; indexing operations  
will find the the last key added.

The types of elements may be specified; this is useful when keys or  
values of `Union` or `Any` types are desired.

```
imdict = Base.ImmutableDict{Symbol,Any}(key=>value, key=>value,
...)

```

An empty `ImmutableDict` can be created by specifying the type and  
giving no pairs; the type must be specified.

```
imdict = Base.ImmutableDict{Symbol,Any}()

```

---

<div class="post-metadata">

**Author:** ![rmfritz](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Post date:** [April 17, 2025, 2:24am UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/4 "2025-04-17T02:24:58Z")

</div>

There have been no further comments, one like from someone who seems to be a respected member of the community. I’m going away, but when I get back, I think I’ll submit this.

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [April 18, 2025, 6:33am UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/5 "2025-04-18T06:33:52Z")

</div>

Yeah, sure, submit it 🙂

I would maybe leave out the parts where you interpret or the “it is intended for” part. That is maybe too verbose prosaic for a documentation.  
Similarly the explanation on public/export – just mention what it is without explanation.

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [April 18, 2025, 7:13pm UTC](https://discourse.julialang.org/t/immutabledict-documentation/128033/6 "2025-04-18T19:13:59Z")

</div>

> [@rmfritz](#):
>
> After stumbling through using an ImmutableDict

It sounds like you had difficulty using the data structure based on the current docs - if so, make sure to mention that, and to specify that the docs you have written are based on your experience as a docs reader and user.
