# Union type structs

**URL:** <https://ziggit.dev/t/union-type-structs/17282>\
**Category:** Help\
**Tags:** language, type-system\
**Created:** [August 18, 2026, 2:06am UTC](https://ziggit.dev/t/union-type-structs/17282 "2026-08-18T02:06:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Southporter](https://ziggit.dev/user_avatar/ziggit.dev/southporter/32/2500_2.png) [@Southporter](https://ziggit.dev/u/Southporter)\
**Post date:** [August 18, 2026, 3:14pm UTC](https://ziggit.dev/t/union-type-structs/17282/4 "2026-08-18T15:14:07Z")

</div>

> [@Vexo413](#):
>
> do you think this will change in the future

I don’t think so, since it would require changing the language parsing/grammar. Since structs are already containers, then files fit that model. Enums and unions _can_ be containers, but then it is ambuguous whether a file is a struct or an enum. There is no way to tell.  
For example, if we were to have the file be an enum or union, is the following a struct, an enum, or a union?

```zig
this: u8,
that: u8,
another: SomeType,

```

The unified body parsing for these container makes it hard to tell. You would have to have some kind of hint or something.

Structs make the most sense since they are the more expected behavior.  
There has been other discussion along this line:

- [.zig files as enum containers](https://ziggit.dev/t/zig-files-as-enum-containers/13290)
- [Extern file containers](https://ziggit.dev/t/extern-file-containers/9179)

* * *

Disclaimer: I am not a compiler dev, all opionions are my own.

---

_[View the full topic](https://ziggit.dev/t/union-type-structs/17282)._
