It is quite weird. 
If I type in the REPL the following lines:

> f(a=1, b=2) = a + 2b
> f(a::Int, b::Int) = a - 2b
> f() # this gives me -3
> f(1,2) # this gives me -3

but if I type 
> f(a=1, b=2) = a + 2b
> f() # -> 5
> f(a::Int, b::Int) = a - 2b
> f() # -> 5 again
> f(1,2) # -> -3

so the call f() changes the behavior.


On Monday, April 18, 2016 at 6:00:10 PM UTC+2, Yichao Yu wrote:
>
> On Mon, Apr 18, 2016 at 11:47 AM, Didier Verna <did...@didierverna.net 
> <javascript:>> 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 ? 
>
> I get `-3` for both, even though it should really be 5 and -3. 
> I won't be surprised that you see the correct result due to #265 
>
> There's also an old issue to track this confusing behavior. 
> https://github.com/JuliaLang/julia/issues/7357 
>
> > 
> > -- 
> > ELS'16 registration open! http://www.european-lisp-symposium.org 
> > 
> > Lisp, Jazz, Aïkido: http://www.didierverna.info 
>

Reply via email to