-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Avoid method overwriting in julia1-compat
branch
#57
Comments
Hmmm, that's an interesting suggestion. At a glance, that looks viable, but I don't think we can do something similar with |
I think limited support would be more beneficial (i.e., less troublesome) than method overwriting. |
Maybe, the goal I went into with this though was to make it behave as close to the 1.11 stdlib as possible, and it's extremely close. As far as I'm aware, the problem with method overwriting here is he latency impact, is there anything beyond that? |
Whether or not method overwriting is performed is a greater difference than missing annotations in some cases. |
Right, but what's the negative impact of the method overwriting? AFAIU it's just the latency. |
This is a tautology, but it is a problem because method overwriting is a problem that is worthy of a warning. Older julia in particular are somewhat fragile with precompilation. Also, I think we need to clarify the relationship between this package and Compat.jl. |
In the first place, the any(_isannotated, args) # `any(_isannotated, iterator)` ? julia> join(("a", styled"{bold:b}"), ", ")|>typeof
String
julia> join(["a", styled"{bold:b}"], ", ")|>typeof
Base.AnnotatedString{String}
julia> versioninfo()
Julia Version 1.12.0-DEV.469
Commit 0d1d4ba068 (2024-05-06 21:04 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
WORD_SIZE: 64
LLVM: libLLVM-17.0.6 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) |
Right, but the overwriting doesn't happen during precompilation. Chatting about method overwriting on Triage with Jeff, he said method overwriting is a fine thing to do.
There is no relation, I can't say I see the need? |
Looks like that's worthy of an issue in JuliaLang/julia, either the |
My point here (not in JuliaLang/julia) is that even with limited support for The following is just a PoC, but it works minimally. join(iterator, delim::Union{AbstractString, AbstractChar}) = _join_preserve_annotations(iterator, delim)
join(iterator, delim::Union{AbstractString, AbstractChar}, last) = _join_preserve_annotations(iterator, delim, last) Edit: join(iterator, delim::Union{AnnotatedChar, AnnotatedString}) = _join_preserve_annotations(iterator, delim)
join(iterator, delim::Union{AnnotatedChar, AnnotatedString}, last) = _join_preserve_annotations(iterator, delim, last) |
The |
Ah, right I follow now. |
Not quite, we do want |
xref: https://discourse.julialang.org/t/method-overwriting-in-styledstrings-jl-v1-0-julia1-compat/113935 |
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):Edit:
An alternative is to require that the first 2 or 3 arguments should contain
Union{AnnotatedChar, AnnotatedString}
.The text was updated successfully, but these errors were encountered: