comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Is there a less clunky syntax for retrieving data from an array of hashes?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Is there a less clunky syntax for retrieving data from an array of hashes? [message #85703] Wed, 28 August 2013 19:44 Go to previous message
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
I'm (finally) playing around with the 'new' IDL LIST() and HASH() features. I must say I'm fairly un-impressed so far. The syntax is very clunky in the same way the custom object syntax has always been clunky. They look and feel like what they are, bolted on bits to the language with enough effort put in to say 'we have this feature' without actually implementing them in a usable way.

Anyhoo, enough belly aching. Is there a more natural way to do this:

> h = hash()
> h['a']=1
> h['b']=2
> harr = replicate(h,10)

Now I want to pull out a value:

> harr[0]['a']

Causes an error

> (harr[0])['a']

works, but makes for some horribly difficult to read code, particularly if you need to further nest the data structures with more hashes in hashes or arrays. Is there any way to improve this (possibly via compiler flags?).

Note that the same is true if you have a hash of hashes, you still need the fully enclosing brackets, Yuck!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: find_npeaks.pro code
Next Topic: write_csv header problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 16:20:46 PDT 2025

Total time taken to generate the page: 0.71705 seconds