-
-
Couldn't load subscription status.
- Fork 5.7k
Closed
Labels
HacktoberfestGood for Hacktoberfest participantsGood for Hacktoberfest participantsdocsThis change adds or pertains to documentationThis change adds or pertains to documentation
Description
I am not sure if this is a bug, but the following certainly creates some unexpected behavior (unexpected error message at least) and debugging headache where the assignment to length was supposed to be a test length(b)==2.
function f(a, b)
N = length(a)
length(b) = 2
return N
end
f((1,2),(3,4))which results in
ERROR: UndefVarError: length not defined
in f(::Tuple{Int64,Int64}, ::Tuple{Int64,Int64}) at ./REPL[3]:2especially when the assignment is not even reachable
function g(a, b)
return length(a)
length(b) = 2
end
g((1,2),(3,4))ERROR: UndefVarError: length not defined
in g(::Tuple{Int64,Int64}, ::Tuple{Int64,Int64}) at ./REPL[6]:2Notice that the error occurs at the length(a) call, not in the assignment statements.
Running Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Metadata
Metadata
Assignees
Labels
HacktoberfestGood for Hacktoberfest participantsGood for Hacktoberfest participantsdocsThis change adds or pertains to documentationThis change adds or pertains to documentation