Is there a way to suppress "method overwritten" warnings?

yet actually the problem i posed - the was NO ANY redefinition… just multiple script invocations (quite usual so far i can take in for the Julia development cycle )

If you include a script with method definitions multiple times, then you are indeed overwriting methods.

1 Like

NO I include NO additional scripts,- just rerun main (a single one) - but with a dozen functions in… It worth to note…there was NO any warnings at the FIRST invocation( it spread out on the subsequent)

Exactly

See https://github.com/Ismael-VC/Suppressor.jl
which does exactly what you want

julia> f(x) = 1
f (generic function with 1 method)

julia> @suppress f(x) = 2
2

Thank you - it works! But the solution is a bit verbose (i do hope for some repl key or option), for i need to wrap in every function i have…
In the my case it is better than none, but of course -the proper implementation of the feature within jit is still preferred and waited (by me)

You can @suppress include(filename), I think. Or use ClobberingReload.sinclude(filename)

thanks, i’ll take it in the account when the time to restructure the script is up to come

If you aren’t changing the functions, why not put all of your function definitions into a separate file (or module) and include that once?

Well i have some experience to make scientific computations (and end-user apps) and teaching (at an university ) with traditional programming languages (C, C++,Fortran, Delphi). and of course I KNOW how to develop size scaled program with (not by the hearings and readings). On the other hand// I put an eye on the Julia lang 3 years ago. Some of its KEY ideas and features behind her seemed very disputable to me, but the language and its Eco-infrastructure were too raw (for me) to put the ideas to test. Now i just want to get COMPLEX experience (the language, ide, build in libraries, external packages… ) to solve complex (in sense many-component) small-world problem and to make the opinion of my own. For as a lecturer I MUST have one (if i want to teach somebody it)/ So i do not want to make obvious (for you) things just for “clear experiment” sake.

It’s already implemented. And there’s only one issue left for v0.6

https://github.com/JuliaLang/julia/milestone/20

That one issue already has a WIP PR. In other words. chill a little bit. For now, if you’re not changing around the functions, it doesn’t hurt and is just a warning, and @suppress will work fine in a pinch.

I take it in… and from my hand -tried to clarify my motivations… so let us be over with the topic and i sincerely thank for, everybody who is involved in

You can suppress any expression, including blocks, ie:

using Suppressor: @suppress_err

@suppress_err begin
    f1() = :foo
    f2() = :bar
    f3() = :baz
end

Apparently, it does not work anymore with Julia 1.0. Any suggestion?

FYI, I created an issue here.

Regarding the original issue (method overwritten messages): if someone still finds them problematic in practice, it would be great to know more about the context, especially a precise MWE.

In particular, when one is developing using one of the recommended workflows with Revise.jl, this should not show up. Similarly when (re)loading a package which is written in a reasonably clean way — if methods are overwritten, it is worth a look.

Any news on this?

In one of my packages, I should override some method from another package that is causing issues (I need to suppress the warning for other users not on my computer)

If it’s a bug in the other package, patch the package…

1 Like

I have opened a PR to the package, but it has been open for a long time.

Unfortunately, Project.toml doesn’t support linking to a fork. Maybe I should register the package under a new UUID and name. Also, using Manifest.toml isn’t robust, since every Julia version generates different Manifest.toml.

I would recommend opening an issue about offering to take over package maintenance before that.