On Mon, Sep 7, 2015 at 12:05 AM, Michele Zaffalon
<michele.zaffa...@gmail.com> wrote:
> Why does
> input_len::Uint = sizeof(bytes_input)
> work in the body of the function but not at the REPL?

We don't have typed global yet.

https://github.com/JuliaLang/julia/issues/8870

>
> Inside the function, it is converted to
> _var0 = sizeof(bytes_input::Array{Uint8,1})::Int64
> input_len = (top(box))(Uint64,_var0::Int64)::Uint64 # line 3:
>
>
> On Sunday, September 6, 2015 at 4:31:35 AM UTC+2, Corey Moncure wrote:
>>
>> Can someone help me understand what's going on here?
>> Maybe I've been sitting at my desk too long?
>>
>> julia> arr = hex2bytes("14fb9c03")
>> 4-element Array{Uint8,1}:
>>  0x14
>>  0xfb
>>  0x9c
>>  0x03
>>
>> julia> f(x) = abs((x % 3) - 3)
>> f (generic function with 1 method)
>>
>> julia> function test_abs(bytes_input::Array{Uint8})
>>        input_len::Uint = sizeof(bytes_input)
>>        a::Int = f(input_len)
>>        println("a: ", a, " input len: ", input_len)
>>        end
>> test_abs (generic function with 1 method)
>>
>> julia> test_abs(arr)
>> a: -2 input len: 4                  <-- minus 2????
>>
>> julia> sizeof(arr)
>> 4
>>
>> julia> f(4)
>> 2                                   <-- expected
>>
>>
>>
>>
>

Reply via email to