Is it possible to make alias for String type some how which inherits all the logic from String and then make multiple dispatch by this custom type?
For example:
If you define indexing and iterating, most other behaviors should come for free (I think). As long as most methods in base use AbstractString (which they should), you’ll get the rest of the behavior for free.
I am curious about the context. You have multiple versions of an object that contain only the String as data and want to dispatch based on the “type” of string. Do you mind explaining a little bit how this pattern comes about?
There may be other solutions that avoid writing a wrapper.
If you are worried that there may be methods in other code that are defined for String rather than AbstractString and that should work for your type of string, then a wrapper would not work.
If you only care about multiple dispatch for new methods that you define, then perhaps traits would be the solution (with dynamic dispatch, though).