What is the difference between enum and shared immutable?
Jan Hönig
hrominium at gmail.com
Wed Oct 28 21:54:19 UTC 2020
Maybe this is a silly question, but I don't understand completely
the difference between an `enum` and a `shared immutable`.
I could have:
enum x = 1;
or
shared immutable x = 1;
What is the exact difference between those too?
My best guess is, that shared immutable gets initialized during
the beginning of the programm execution.
Enum has to be "ready" at compile time.
Is this this accessment correct and complete?
Am I missing anything else?
(If correct, then I understand that shared immutable is capable
of doing some sideeffects during is construction (if the
constructor does that))
More information about the Digitalmars-d-learn
mailing list