I didn't realize ÷ was div!  I think people would be happier if they knew 
they could use A[n÷2] instead of A[div(n,2)].

On Sunday, November 15, 2015 at 12:48:54 PM UTC+11, Steven G. Johnson wrote:
>
> See also
>
>     https://github.com/JuliaLang/julia/issues/10154
>
> where a lot of this was discussed.
>
> Non-integer indices often indicate a mistake on the part of the programmer 
> (e.g. using / rather than ÷, i.e. div), and it is more reliable to force 
> the programmer to be explicit about what was intended (both to indicate 
> whether they want round/floor/ceil, and to correct unintentional type 
> instabilities that often accrue from accidental floating-point indices).   
> It is also a headache for people implementing AbstractArray subtypes, 
> because it creates an expectation that they will implement non-obvious 
> getindex methods for Real types, with calls to the to_index method as 
> needed.
>
> I feel like 99% of the problems that people have with deprecating 
> floating-point indices arise because they used / rather than ÷ for an 
> integer division.   I wonder if there is some way to give a helpful warning 
> in such cases?
>

Reply via email to