Do you really? I just ran this regex r"^\s*(\w+)\s*=.*;\s*\1\s*$" on
Julia's code base and all .jl files in all the packages I have installed
for both 0.3 and 0.4 and there are zero matches.

On Wed, Sep 16, 2015 at 5:52 PM, Scott Jones <[email protected]>
wrote:

> This is why you see frequently in Julia functions:
> x = expr ; x
>
>
>
> On Wednesday, September 16, 2015 at 5:25:15 PM UTC-4, ggggg wrote:
>>
>> That makes a lot of sense, thanks.
>>
>> On Wednesday, September 16, 2015 at 2:22:54 PM UTC-6, Spencer Russell
>> wrote:
>>>
>>> There’s an issue where Jeff describes the reasoning here:
>>> https://github.com/JuliaLang/julia/issues/5532
>>>
>>> On Sep 16, 2015, at 3:57 PM, j verzani <[email protected]> wrote:
>>>
>>> The return value of the function is value of the last expression
>>> evaluated. For assignment, the right-hand side is always returned. So in
>>> `f` you get the value x*2.0 returned which is 2.0.
>>>
>>> On Wednesday, September 16, 2015 at 3:41:22 PM UTC-4, ggggg wrote:
>>>>
>>>> I was playing around with type declarations and came across an
>>>> counterintuitive result. I'm not sure if this is the intended behavior or
>>>> not, but it certainly surprised me.
>>>>
>>>> Consider the functions
>>>>
>>>> *function f(x)*
>>>>
>>>>        *y::Int*
>>>>
>>>>        *y=x*2.0*
>>>>
>>>> *end*
>>>>
>>>> *function g(x)*
>>>>
>>>>        *y::Int*
>>>>
>>>>        *y=x*2.0*
>>>>
>>>>        *y*
>>>>
>>>> *end*
>>>>
>>>> *julia> **f(1),g(1)*
>>>>
>>>> *(2.0,2)*
>>>>
>>>> I expected them to behave identically, always returning an Int. But
>>>> clearly f returns a Float64.
>>>>
>>>>
>>>> It seems like in the presence of the type delaration y=x*2.0 is
>>>> interpreted as
>>>>
>>>> temp=x*2.0
>>>>
>>>> y=Int(temp)
>>>>
>>>> temp
>>>>
>>>> is that right?
>>>>
>>>
>>>

Reply via email to