Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is not array getter #52

Open
diegozea opened this issue Jun 27, 2017 · 4 comments
Open

There is not array getter #52

diegozea opened this issue Jun 27, 2017 · 4 comments

Comments

@diegozea
Copy link
Contributor

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,

@davidavdav
Copy link
Owner

davidavdav commented Jun 27, 2017 via email

@diegozea
Copy link
Contributor Author

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?

@davidavdav
Copy link
Owner

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.

@diegozea
Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants