-
-
Couldn't load subscription status.
- Fork 5.7k
Description
[Originally posted on -dev by Fermat 618: https://groups.google.com/d/topic/julia-dev/MOt74gNrc9E/discussion]
When I assign a lambda to a function,
julia> f(x) = x + 2
julia> f = (x) -> x + 20
Warning: redefinition of constant f ignored.
#<function>
julia> f(3)
5
I find neither an Error is raised nor the assignment take effect.
It is very dangerous to ignore an error. A program that returns a wrong
answer is much more worse than a program that fails.
When I write something, I expected it to take effect. If it do not, I
expect an error. A warning is reasonable when someone write
if (a = b) { xxx; }
in C. Even though if (a == b) is likely what one want, one can still
ignore the warning when he/she is sure if (a = b) is wanted. But this
is definitely not the case.
In my opinion, a well designed programming language should give as less
[warnings] as possible.