# InternPool: create specialized functions for loading namespace types · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/975b859377dee450418ae9ed572ec9d3c0b77312)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 975b859377dee450418ae9ed572ec9d3c0b77312

Requested commit: 975b859377dee450418ae9ed572ec9d3c0b77312

Commit: 975b859377dee450418ae9ed572ec9d3c0b77312

Tree: 08a86de7c929deb2a86deb5b587f35bb980ca500

Author: mlugg

Committer: mlugg

## Message

```
InternPool: create specialized functions for loading namespace types

Namespace types (`struct`, `enum`, `union`, `opaque`) do not use
structural equality - equivalence is based on their Decl index (and soon
will change to AST node + captures). However, we previously stored all
other information in the corresponding `InternPool.Key` anyway. For
logical consistency, it makes sense to have the key only be the true key
(that is, the Decl index) and to load all other data through another
function. This introduces those functions, by the name of
`loadStructType` etc. It's a big diff, but most of it is no-brainer
changes.

In future, it might be nice to eliminate a bunch of the loaded state in
favour of accessor functions on the `LoadedXyzType` types (like how we
have `LoadedUnionType.size()`), but that can be explored at a later
date.

```

## Parents

- [a6ca20b9a1dfc7b6e8d004cb166c0714bb8db2db](https://git.cafe/gitcafe/zig/commit/a6ca20b9a1dfc7b6e8d004cb166c0714bb8db2db?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/975b859377dee450418ae9ed572ec9d3c0b77312?format=markdown)
