www.digitalmars.com         C & C++   DMDScript  

D - querying keys in an associative array

reply chris schoeneman <crs shutterfly.com> writes:
i didn't see anything in the spec about iterating over or otherwise
getting the keys in an associative array.  is that supported?  i'd
really miss it if it wasn't (i routinely use that capability of
perl).

also, is the range [] operator illegal for an associative array?
i didn't see anything about the order of keys.  without that, a
range would have no meaning, of course.  that's fine and gives
the compiler more flexibility.

cheers,
-chris
Aug 17 2001
parent reply "Walter" <walter digitalmars.com> writes:
Yes, there will be a .keys property for associative arrays that will give
all the members as a regular array. -Walter

chris schoeneman wrote in message <3B7D9FC1.4FA48103 shutterfly.com>...
i didn't see anything in the spec about iterating over or otherwise
getting the keys in an associative array.  is that supported?  i'd
really miss it if it wasn't (i routinely use that capability of
perl).

also, is the range [] operator illegal for an associative array?
i didn't see anything about the order of keys.  without that, a
range would have no meaning, of course.  that's fine and gives
the compiler more flexibility.

cheers,
-chris

Aug 17 2001
parent reply weingart cs.ualberta.ca (Tobias Weingartner) writes:
In article <9lknn3$2sig$2 digitaldaemon.com>, Walter wrote:
 
 Yes, there will be a .keys property for associative arrays that will give
 all the members as a regular array. -Walter

Associative arrays in the base language? Why not make it part of the base library instead? At least then you can more easily support user supplied hashing techniques, etc. --Toby.
Aug 20 2001
parent "Walter" <walter digitalmars.com> writes:
If it's in the class library, then there's templates, operator overloading,
etc.

Tobias Weingartner wrote in message ...
In article <9lknn3$2sig$2 digitaldaemon.com>, Walter wrote:
 Yes, there will be a .keys property for associative arrays that will give
 all the members as a regular array. -Walter

Associative arrays in the base language? Why not make it part of the base library instead? At least then you can more easily support user supplied hashing techniques, etc. --Toby.

Aug 20 2001