Skip to content

Commit

Permalink
Fix typo in anti-pattern docs (#13943)
Browse files Browse the repository at this point in the history
  • Loading branch information
amalbuquerque authored Oct 31, 2024
1 parent f9eda1c commit 8f594a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/elixir/pages/anti-patterns/code-anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ The Erlang VM has two internal representations for maps: a flat map and a hash m

Maps of up to 32 keys are represented as flat maps. All others are hash map. Structs *are* maps (with a metadata field called `__struct__`) and so any struct with fewer than 32 fields is represented as a flat map. This allows us to optimize several struct operations, as we never add or remove fields to structs, we simply update them.

Furthermore, structs of the same name "instantiated" in the same module will share the same "tuple keys" at compilation times, as long as they have fewer than 32 fields. For example, the following code:
Furthermore, structs of the same name "instantiated" in the same module will share the same "tuple keys" at compilation times, as long as they have fewer than 32 fields. For example, in the following code:

```elixir
defmodule Example do
Expand All @@ -583,4 +583,4 @@ Removing this anti-pattern, in a nutshell, requires ensuring your struct has few

* You could nest fields as tuples. For example, if two fields are always read or updated together, they could be moved to a tuple (or another composite data structure)

The challenge is to balance the changes above with API ergonomics, in particular, when fields may be frequentlyb read and written to.
The challenge is to balance the changes above with API ergonomics, in particular, when fields may be frequently read and written to.

0 comments on commit 8f594a3

Please sign in to comment.