1. It clearly isn't.

2. It will not cause any overhead in the common case (because it would be a 
separate method in Julia). The question is whether this is a case where we 
should guess what the user intended, or force the user to fix a potential 
problem.

Not sure what we could do about this though, because the distinction is 
useful and it becomes much more annoying if you discover such subtle 
differences later rather than earlier. 

Ivar

kl. 04:19:53 UTC+2 mandag 21. juli 2014 skrev Abe Schneider følgende:
>
> It wasn't obvious to me initially why `sort` wasn't working for me 
> (strings and composite types). On further investigation it looks like that 
> it only works for single-dimension arrays -- which makes sense. However, if 
> I type:
>
> lst = ["a" "b" "c"]
> sort(lst)
>
> I get an error. The answer is that it's of type `Array{ASCIIString, 2}`, 
> whereas `sort` wants the type to be `Array{ASCIIString, 1}`. The correct 
> solution is to write this instead:
>
> lst = ["a", "b", "c"]
> sort(lst)
>
> The problem seems to derive from two design decisions:
>
>    1. It is not obvious to someone new to Julia why one form gives a two 
>    dimensional array whereas the other gives a one dimensional array.
>    2. `sort` doesn't try to determine if the array passed is actually 
>    jeust one dimensional.
>
> I'm not sure there is a simple solution. I assume there's a good reason 
> for (1) and (2) involves some overhead which might be undesirable.
>

Reply via email to