Closed
Description
StyledStrings v1.0 currently does method overwriting.
StyledStrings.jl/src/strings/overrides.jl
Lines 1 to 15 in db9f9b5
At least for *
, we should be able to avoid overwriting by defining the following (or something like):
function (*)(s1::Union{AnnotatedChar, AnnotatedString}, s2::Union{AbstractChar, AbstractString})
annotatedstring(s1, s2)
end
function (*)(s1::Union{AbstractChar, AbstractString}, s2::Union{AnnotatedChar, AnnotatedString})
annotatedstring(s1, s2)
end
function (*)(s1::Union{AnnotatedChar, AnnotatedString}, s2::Union{AnnotatedChar, AnnotatedString})
annotatedstring(s1, s2)
end
function (*)(s1::Union{AbstractChar, AbstractString}, s2::Union{AbstractChar, AbstractString}, ss::Union{AbstractChar, AbstractString}...)
if _isannotated(s1) || _isannotated(s2) || any(_isannotated, ss)
annotatedstring(s1, s2, ss...)
else
string(s1, s2, ss...)
end
end
Edit:
An alternative is to require that the first 2 or 3 arguments should contain Union{AnnotatedChar, AnnotatedString}
.
Metadata
Metadata
Assignees
Labels
No labels