Perhaps the motivation for this behavior is that you can use 2d indexing on 
a 1d vector:

julia> x = [1,2,3];

julia> x[1,1]
1

julia> x[1,2]
ERROR: BoundsError()

Whether it makes sense to allow this is another question.

On Wednesday, August 13, 2014 8:59:03 PM UTC-6, Isaiah wrote:
>
> size(x,n) apparently works to arbitrary n. I don't think this is 
> intentional, because the C implementation includes a dimension check (this 
> call goes through codegen even at the REPL).
>
>
> On Wed, Aug 13, 2014 at 4:54 PM, Dominique Orban <[email protected] 
> <javascript:>> wrote:
>
>> I'm wondering if the following behavior is intentional and what the 
>> rationale is:
>>
>> julia> x = rand(5);
>>
>> julia> size(x)
>> (5,)
>>
>> julia> n = size(x,1)
>> 5
>>
>> julia> m = size(x,2)
>> 1
>>
>> julia> (n, m) = size(x)
>> ERROR: BoundsError()
>>
>> I would expect either both size(x,2) and (n,m) = size(x) to work and be 
>> consistent, or both to return the same error...
>>
>>
>

Reply via email to