How would you implement a Symbol type?

Symbols, aka “atoms” or “interned strings”, are a useful type. How would you implement a Symbol type in LLVM?

It’s important to me that my symbols are not considered equal to any number or string type. They also can’t be considered greater or lesser than each other. Only equal to their self and not equal to anything else. I don’t need to create new symbols at runtime – they are all singletons that can all be known at compile time.

x = 'Yes
y = 'Yes
z = 'No
x == y # true
x != z # true
x > z # error
x == 0 # error
x == "Yes" # error

Ideally they should compare as efficiently as integers, but have names as expressive as identifiers. So internally they could be something like enum values, but without actually being treated like integers by anything other than ==.

Is this a time when I would want to use the ValueSymbolTable directly?

You could use the constant keyword.