On Monday, 1 February 2021 at 09:40:20 UTC, Per Nordlöw wrote:
An enum only exists at compile-time, and does not occupy any
space. Each time it's referenced, a new instance of the value
is created. Why is that? Seems like a waste of resources to the compiler.

It makes perfect sense for numeric values, strings, characters and similar values. Why waste extra space on a variable if it's not needed?

If you don't want a new instance, then don't use `enum`. Use `immutable` instead.

--
/Jacob Carlborg

Reply via email to