-
Notifications
You must be signed in to change notification settings - Fork 20
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
ones(), zeros(), cat() change key type of name dictionary #60
Comments
I'm not sure if it is related to #58, but it definitely is something I wasn't aware of an that needs some attention. The type stability issue still hasn't been resolved, it is a pretty tough one. |
It looks like the culprit is In that sense it is related to #58, because the current declaration dicts = Array{OrderedDict{Any,Int}}(nd) helps to fix #58, but causes this #60. So far the conclusion is that I am not a very good type stability programmer. |
It should be much easier to fix than #58, though. You can just define a |
Thanks, that idea crossed my mind, too. That is probably easiest. |
The julia> n = NamedArrays.NamedArray(rand(3), [DataStructures.OrderedDict(:a => 1, :b =>2, :c =>3)])
3-element Named Array{Float64,1}
A │
───┼──────────
:a │ 0.0794262
:b │ 0.28769
:c │ 0.123761 Both |
What do you mean by "reinvent names"? Why couldn't |
So currently, a |
I would have expected the names generated by BTW, when writing inferrable code is too hard, generated function can help, since they allow doing whatever complex operations you need to compute manually the return type based on the input types, and then the compiler doesn't have to guess that type. |
The original names can be anything, not just symbol or string, so I don't see how a general sensible naming scheme can be devised. |
Yes, Then indeed for custom name types it might not be possible to create unique names as for strings, but that doesn't sound like a sufficient reason to avoid reusing names when possible: better optimize for the most common case where either names are unique, or they are strings and can be made unique. Maybe just throw an error when duplicated names are found and they are neither strings nor symbols? |
A very useful package, thanks a lot for your work!
Some functions seem to change the type of the keys of the name dictionaries to
Any
. For example:Maybe it is related to #58 but I hope it is still useful to report.
As workaround for
zeros
andones
I use currently this:The text was updated successfully, but these errors were encountered: