Just a sanity check...
I've been studying Grid.jl <https://github.com/timholy/Grid.jl> and one of
the neat tricks there is to inherit from AbstractArray, which allows us to
write our own getindex. However, the indices are not integers. I like this
trick enough I am considering making it a common structure when dealing
with "arrays with additional info". At one point, I also got this
deprecation error and it made me nervous.
Although non-integer indexing is deprecated, am I still allowed to do it if
I build my own getindex? Or, put another way, will Grid.jl still work?
Thanks.
PS: I am finally starting to do some real modeling with Julia and I have to
say that although it is sometimes tough for my aging grey matter, when I do
get something to work the experience is intellectual satisfying. Kudos to
the Julia development team. This is a programming language "done right".
On Thursday, March 19, 2015 at 4:54:23 AM UTC+8, David van Leeuwen wrote:
>
> On a somewhat related note: if you really require non-integer indices, you
> can always try NamedArrays:
>
> using NamedArrays
> m = NamedArray(rand(4), ([1//1, 1//2, 1//3, 1//4],), ("weird",))
> m[1//1]
> m[1//2] == m[2//4]
> m[1//4] == m[4]
>
> ---david
>
> On Monday, March 16, 2015 at 8:50:13 AM UTC+1, Mauro wrote:
>>
>> On Mon, 2015-03-16 at 08:40, Christoph Ortner <[email protected]>
>> wrote:
>> > Lex, Stefan: Would it not be possible to throw an exception when the
>> > conversion is considered "unsafe"?
>>
>> That's the current behavior:
>>
>> julia> [1,2][1.0]
>> 1
>>
>> julia> [1,2][1.0001]
>> ERROR: InexactError()
>> in getindex at array.jl:246
>>
>> julia> [1,2][1.+eps(1.)]
>> ERROR: InexactError()
>> in getindex at array.jl:246
>>
>>