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

Home » Public Forums » archive » modifying hash/dict elements
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 hash/dict elements [message #88647] Fri, 23 May 2014 06:23 Go to previous message
JDS is currently offline  JDS
Messages: 94
Registered: March 2009
Member
I wonder why this doesn't work:

IDL> h=hash()
IDL> h['foo']++
% Type conversion error: Unable to convert given STRING to Long64.

nor:

IDL> h=dictionary()
IDL> h.foo++
% Data of this type cannot be used with increment or decrement operators:
POINTER.

nor do keys auto-instantiate when referenced:

IDL> h.foo+=1
% Key does not exist: "FOO"

and yet:

IDL> h.foo=1
IDL> h.foo+=1

work fine.

I think dicts/hashes should auto-subtantiate keys on any left-hand access, not just assignment, and that all elements of dicts/hashes should be available for any left-hand operation, including increment/decrement.

JD
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: vector subscripts not working
Next Topic: GDL workshop in France, 10-13 June 2014

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

Current Time: Wed Oct 08 13:34:27 PDT 2025

Total time taken to generate the page: 0.00485 seconds