Re: Is there a less clunky syntax for retrieving data from an array of hashes? [message #85707 is a reply to message #85703] |
Wed, 28 August 2013 23:14   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
Hi Bogdanovist,
I'm going to respond to your post in reverse order. Both the List and Hash were really designed to be "scalar" objects. It is just a happy coincident that you can create arrays of them, but I would strongly recommend that you do not do that. Instead, you would be better off just putting your data into the List or Hash. Since you can put data of any type, you could just create a List of Hashes to do what you want.
Then, if you do that, you can use the new array syntax to access array elements (or hash/list elements) within a list or hash. For example:
IDL> a = List(Hash('key', findgen(10)))
IDL> help, a[0, 'key', 5:8]
<Expression> FLOAT = Array[4]
IDL> a[0, 'key', 5:8] = 6
IDL> print, a[0, 'key', 5:8]
6.00000 6.00000 6.00000 6.00000
Hopefully this will address your needs for the List/Hash.
Regarding your first paragraph, it would be great to get specific information. Besides the above questions about array indexing, what else do you think is missing or bad about the List & Hash implementation? Specific use cases are very helpful!
By the way, we don't add anything just to check off on a marketing list. Everything we add has at least one or more customers who have requested it, or it is something that we personally would like to have in the language or need for our other products. We don't have time to add fluff features.
All that being said, there are certain limitations that we have with our existing code, the IDL parser, and the IDL interpreter. In many cases (like array indexing), we cannot change the existing implementation without serious risk of breaking backwards compatibility. So even though some features may appear to look "bolted on," there is always careful design and architecture that is done behind the scenes. Finally, we rely on you, the users, to give us feedback about bugs or missing features, so that we can address them in the next release. So, let us know!
Cheers,
Chris
IDL Project Lead
ExelisVIS
|
|
|