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

Home » Public Forums » archive » Modifying Arrays and Structures in HASH's (hint: you can't)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Modifying Arrays and Structures in HASH's (hint: you can't) [message #79688] Thu, 22 March 2012 14:58 Go to previous message
JDS is currently offline  JDS
Messages: 94
Registered: March 2009
Member
HASH's are nice in that they can contain any variable type, and make iterating over deeply nested data structure more humane. On the other hand, their limitations as separate standalone objects, and not as a deeper feature of the language, are very apparent, for example, when you'd like to alter something inside of them:

IDL> h=hash('a',{b:1,c:2})
IDL> print,h['a'].b
1
IDL> h['a'].b=2
% Attempt to store into an expression: Structure reference.
% Execution halted at: $MAIN$ 84

The same happens for arrays stored in hashes. You're required to copy the entire array or structure out, modify it, then copy it back into the hash (remind anyone of the old days and widget state?). If it were possible for HASH dereferencing to return true IDL variable references, they would be far more useful.

Any workarounds to this "write-only" HASH behavior (other than, say, "use a pointer")?

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Does anyone have any experience with using SciDB with IDL (or any other language)?
Next Topic: Find all user-defined structure definitions

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

Current Time: Wed Oct 08 16:01:26 PDT 2025

Total time taken to generate the page: 0.01530 seconds