NamedArrays.jl
NamedArrays.jl copied to clipboard
There is not array getter
Now that array() was deprecated there is not an array getter. Could be great to have a getter (getarray or similar) in order to not access directly the array field.
Best regards,
What is the advantage of having a getter like that over accessing the field?
Would Array() work for you?
---david ( 大卫)
Op 27 jun. 2017 13:46 schreef "Diego Javier Zea" [email protected]:
Now that array() was deprecated there is not an array getter. Could be great to have a getter (getarray or similar) in order to not access directly the array field.
Best regards,
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davidavdav/NamedArrays.jl/issues/52, or mute the thread https://github.com/notifications/unsubscribe-auth/AFPh10YXQFZGtcQPH_cUKBVXG0Gimvq9ks5sIOupgaJpZM4OGg4I .
I believe that direct field access is discouraged in Julia, but I'm not sure. However, is good to have a stable getter in case that the internal array field change in the future. However, I'm moving my code to using *.array. Could Base.Array create a problem in the future?
I can't really look into the future that well. Personally I don't know what the julia idiom is for these kind of type-conversion functions. I thought things like
n = NamedArray(...)
convert(Array, n)
and
Array(n)
are similar. However, now that I think of it, this probably doesn't solve your problem, as these construct new copies of the array.
There still is array(n) defined in NamedArrays as a getter function. We can promise to keep that if that makes you more comfortable.
There's no problem. At the moment, I have defined my own getter to not write *.array everywhere in the code. I think that some aspects of Array construction are going to change in Julia 0.7/1.0. But, I'm not really sure. Can this decision wait for the release of 0.7?