# Why keyword \`struct\` is used instead of \`type\` for type definition?

**URL:** <https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774>\
**Category:** General Usage\
**Tags:** question, type, struct\
**Created:** [August 29, 2024, 2:36pm UTC](https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774 "2024-08-29T14:36:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [August 29, 2024, 2:36pm UTC](https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774/1 "2024-08-29T14:36:16Z")

</div>

basically the word “type” is used everywhere in docs and function names like `typeof()`. So, why use the keyword `struct` but not `type` in type definition??

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [August 29, 2024, 2:39pm UTC](https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774/2 "2024-08-29T14:39:41Z")

</div>

What’s now `mutable struct` used to be `type`. And what is now `struct` used to be `immutable`.

> <https://github.com/JuliaLang/julia/issues/19157>
>
> Over time, this keyword has increasingly bothered me. There are several problems…:
> \- \`type\` is a very generic word and I'd just as soon leave it available for variable names (and keyword arguments!)
> \- There are now several kinds of types, so it seems strange to use \`type\` to refer only to concrete, mutable, struct-like types.
> \- \`type\` is the most obvious type-defining keyword, but usually \`immutable\` is preferable and recommended.
> 
> Here are some alternate keyword suggestions:
> \- \`mutable\` -- opposite of \`immutable\`!
> \- \`struct\` -- at least says something about what sort of type it is
> \- \`reftype\` -- for "reference type", which also conveys some of its key properties

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [August 29, 2024, 4:01pm UTC](https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774/3 "2024-08-29T16:01:07Z")

</div>

There are many types of types (struct, mutable struct, abstract, primitive, union), only some of which are structs, so it would be misleading to use `type` to describe structs.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [August 29, 2024, 9:23pm UTC](https://discourse.julialang.org/t/why-keyword-struct-is-used-instead-of-type-for-type-definition/118774/4 "2024-08-29T21:23:45Z")

</div>

Also, `struct` is an established name for this purpose, especially in the ‘C family’ of languages.
