11/12/2012 6:43 PM, monarch_dodra пишет:
D has a built in hashed associative container, which is great.



No. The literals are nice though.

I've noticed though it has no built-in "hashed container" for when you
just need to store unique elements, but without any specific data
associated (lists of names, for example).

There is no need for built-in containers. If anything there is plan to move hash out of built-ins. The fact that it utterly failed to happen doesn't prove anything as it still has to be the library type.


Has anybody requested this before? Would there be any plans for it?


----
The current "workaround" is to just dummy it.
alias bool Dummy;
Dummy[string] names;
names["Paul"] = true; //Ew.

Make a wrapper?


But it is not very obvious what is going on. I also tried "void"ing it, eg:
void[string] names;
But that doesn't work either: Error: can't have associative array of void.

----
What would you think of introducing a built-in hashed container, that
contains only keys?

Infinitely awful.


We could call them "HA" for Hashed Array, and declare them with this
simple syntax:


Or rather call them sets and have them in the library.


--
Dmitry Olshansky

Reply via email to