Method overwriting in StyledStrings.jl v1.0 (`julia1-compat`)

StyledStrings.jl, an external stdlib of julia v1.11 or later, was recently registered as a package.:tada:

However, StyledStrings v1.0 currently does method overwriting.

WARNING: Method definition *(Union{AbstractChar, AbstractString}, Union{AbstractChar, AbstractString}...) in module Base at strings/basic.jl:260 overwritten in module AnnotatedStrings at /home/runner/.julia/packages/StyledStrings/e96YA/src/strings/overrides.jl:3.
WARNING: Method definition join(Any) in module Base at strings/io.jl:356 overwritten in module AnnotatedStrings at /home/runner/.julia/packages/StyledStrings/e96YA/src/strings/overrides.jl:13.
WARNING: Method definition join(Any, Any) in module Base at strings/io.jl:357 overwritten in module AnnotatedStrings at /home/runner/.julia/packages/StyledStrings/e96YA/src/strings/overrides.jl:14.
WARNING: Method definition join(Any, Any, Any) in module Base at strings/io.jl:358 overwritten in module AnnotatedStrings at /home/runner/.julia/packages/StyledStrings/e96YA/src/strings/overrides.jl:15.

I understand the necessity of them for compatibility, but I put more emphasis on less trouble.
I don’t think my values are absolutely correct at all. However, as a matter of fact, there is a difference between my values and the ones of @tecosaur, the lead developer.

Another meta problem is the lack of reviewers regarding StyledStrings.jl as an external package, not part of JuliaLang/julia.
For this reason, I would like you to first be interested in the package and the issue.

Then, if you have any information about specific solutions or problems, please comment on the GitHub issue.
This is not a matter with a definitive answer, so for a more general or meta discussion, this might be a good place to start.

2 Likes

Note that my main concern is with older versions like julia v1.6. julia v1.10 should be more robust and have more options to be safer and faster.

In other words, this issue is likely to become less important with the next LTS migration. However, there still will be a demand for v1.6 support in basic packages for some time to come.

1 Like

Also, IIRC, some precompilation problems with v1.7 (or v1.8?) or earlier are due to old caches causing side effects.
Therefore, the workaround I suggest in the GitHub issue may not be an essential solution, since it only changes whether the responsibility lies with the package or with julia. I don’t know much about that.

Why does StyledStrings assume that any AbstractString might be annotated? Shouldn’t those methods be defined only for AnnotatedString?

Simply put, julia versions that do not have AnnotatedString defined are unaware that AnnotatedString must be handled specially.
Methods defined in base have no way to exclude AnnotatedString, and StyledStrings have no way to exclude non-AnnotatedString.

As for *, we have no way to exclude Vararg that do not contain any AnnotatedString.

1 Like

I suggest that limited support might be sufficient.
However, if the support is not all-inclusive, there is the problem of inconsistent behavior.