-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconsider SymbolType
enum
#51
Comments
Just a few thoughts:
Looking forward to your thoughts! |
No enum column type in sqlite. You could create a table with the values you want and use a foreign key constraint to enforce the possible values in the entities table. That may work with the JSON approach we're now using, but it might not. Strings are probably the "simplest" way forward. It's no worse than what we have now. You're still using magic values but they at least make sense to users. You can also stringify the value for free which is nice. We could maybe add a "cleanup" step to check all type fields and shunt the invalid ones to The other option is using a bunch of boolean fields, since our key value pairs can now be anything. This is sort of intuitive: e.g. |
In that case I'd say going for strings as the underlying type makes the most sense. I'd like to have some protection by the type system against invalid enum values (e.g. typos) - not sure if there's a better option than |
We currently have this:
We set this field for an entity based on assumptions from the PDB. If we read a match marker like
// VTABLE
we will set or replace this value based on the type of comparison that is requested.We use the value to decide how to compare each entity. We also use it in the
match_name
function that presents a string describing the entity. This is used in asm sanitize and takes the form of:{name | string text | float number} ({symbol type name})
The problems with this are:
IntEnum
instead of justEnum
.SymbolType
without knowing the internal value (See Load CSV files to populate reccmp metadata #32)SymbolType
anywhere the "type" field is needed. One reason for not doing this is that enums are slow. For what they are, there's more overhead than you would expect. (Again, we have sort of dodged this one by usingIntEnum
)SymbolType
inmatch_name()
it is much faster to use adict
than the "correct" way ofSymbolType(value).name
.The text was updated successfully, but these errors were encountered: