I wrote: > The manual seems wrong about this (0.4.5): > > f(a=1,b=2) = a+2b > f(a::Int,b::Int) = a-2b > f() # -> 5 > f(1,2) # -> -3 > > The manual says that both calls give -3. So who's wrong, the language or > the manual ?
So it seems that optional arguments /values/ are tied to the methods: julia> f(a=1,b=2) = a + b f (generic function with 3 methods) julia> f(a::Int=3,b::Int=4) = a - b f (generic function with 5 methods) julia> f() -1 julia> f(1.5) 3.5 i.e., there's some memory of different optional values for different methods. -- ELS'16 registration open! http://www.european-lisp-symposium.org Lisp, Jazz, Aïkido: http://www.didierverna.info
