I often use Symbols for better efficiency in large DataFrames, but sometimes would still like to filter by calling functions on the value of the Symbols like contains, startswith, endswith, etc. or even length.
Is there a reason why they shouldn’t also be defined for Symbols? Or should AbstractString be extended to include Symbol, since isn’t a Symbol just an interned String?
I agree that they often have distinct use-cases, but I don’t see any downside to extending the functionality of Symbols to allow operations individual characters of the label. Or am I missing something?
Fundamentally, Strings are a collection of characters, while Symbols are not, which is why there isn’t even a getindex method for them, which presumably would be the minimum requirement for things like startswith. My gut says that enabling this sort of stuff for Symbols would be a pretty massive change to the language and isn’t going to happen.
I also think Mark is right, you are probably looking for InlineStrings (or even something like CategoricalArrays if you have lots of repeated strings).