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

more over i am still not sure whether it is bug or ugly implemented feature…

1 Like

to the corrector! It was not the good idea to cut off words from the original topic definition. For the words “confusing” and “useless” describe the problem more precisely/

Overwriting method definitions can lead to unexpected behaviors due to issue #265

This issue has been solved in a still unreleased version of Julia (Julia 0.6). So that now on 0.6

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

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

doesn’t warn anymore.

However, if you are redefining methods of a function so often that the warnings become annoying, you may consider using anonymous functions. They should also behave better wrt possible issues deriving from issue #265.

2 Likes

Thank you. BTW Do you know when it will be released?

Reasonably soon I guess. It’s discussed in this topic. If you want to play with it a bit, you can download the nightly builds on the julialang homepage. I think it already works fine but some of the packages may not be ready for the new version.

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

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.