This is one of the main outstanding quirks about Julia that will get resolved 
at some point in the nearish future.

See https://github.com/JuliaLang/julia/issues/265 for more details.

 — John

On Jan 12, 2014, at 4:02 PM, Andrew Burrows <[email protected]> wrote:

> 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