[Feature Request] Adding to D lang "set" built-in

Russel Winder russel at winder.org.uk
Sun May 6 22:49:00 PDT 2012


On Mon, 2012-05-07 at 00:42 +0200, Andrej Mitrovic wrote:
> On 5/7/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> > you may be better off adapting D's AA implementation
> > to have an AA that consists of just keys.
> 
> Yeah I do that in my code right now. It's pretty easy, just write an
> some opApply/opBinary functions, add to!string(innerhash.keys) for
> good measure and you're set (heh, set).

Any language with which the programmer has to develop their own set
implementation is sadly lacking.

It is true that set can be implemented using a map, but this should be
seen as implementation detail, not as programmer level tool. It
indicates that set should exist where set does. So for C++ it is in the
standard library, for Python it is a built-in (*).

The conclusion for D is straightforward. Which issue to I go to to vote?


(*) Although set was a second class citizen in Python 2, it is a first
class citizen in Python 3. There are even set comprehensions, just as
there are list comprehensions and dictionary comprehensions.  I just
love the influence of functional programming: be data evolution focused,
not control flow focused.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120507/93eb6b1e/attachment.pgp>


More information about the Digitalmars-d mailing list