Hi

I'm rather new to Julia, but I've come across some rather puzzling 
behaviour of the language.

The following code works fine and the assert passes:

a(x) = 12345
b(x) = a(x)
a(x::Int64) = 1000
@assert b(1)== 1000

But this near identical code does not, throwing an assertion error:

a(x) = 12345
b(x) = a(x)
b(1) # <----------- This line is new
a(x::Int64) = 1000
@assert b(1)== 1000

It would seem that the definition of a(x) is being cached but in both cases 
this assert passes fine:

@assert a(1) == 1000

Also this almost identical code works fine:

a(x) = 12345
b(x) = a(x)
a(1) # <----------- This line is now calling a not b
a(x::Int64) = 1000
@assert b(1)== 1000
@assert a(1)== 1000

Is this behaviour a bug or is it by design? Am I doing something wrong or 
is there something I can do to disable what ever is caching my method 
definition or is there any way to work around it?

Cheers
Andy

Reply via email to