News for hackers. Stuff that matters.
Re:Diving into the world of hash tables by mcpherrinm on Sunday June 25, 2017 @09:29PM (#14633360)
While that's true you could implement one that way, it's very nice to have the set operations implemented. Intersection, union, subtraction, etc. And having a uniform set type makes API signatures more consistent.

Plus you may be able to optimize Set<T> to use less space than Map<T, bool>.

Re:Diving into the world of hash tables by slig on Sunday June 25, 2017 @09:38PM (#14633408)
> While that's true you could implement one that way, it's very nice to have the set operations implemented

Unrelated, but does anyone know why the new JavaScript set implementation is so limited? Why didn't they bother doing this right?

Re:Diving into the world of hash tables by TheAceOfHearts on Monday June 26, 2017 @12:14AM (#14634033)
I think I remember reading a claim that they pushed for a small API surface in order to make sure it got through. Now that it's part of the language, anyone else can work on getting those extra features in.

You can implement most basic functionality easily enough, MDN even has an example [0]. Although I agree that it should really be part of the language.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:Diving into the world of hash tables by douche on Sunday June 25, 2017 @09:44PM (#14633435)
Because it is JavaScript, and there's some kind of unspoken rule about not doing things properly and instead releasing broken things.
Re:Diving into the world of hash tables by deckarep on Sunday June 25, 2017 @09:46PM (#14633441)
This exactly, I hear over and over: just use a hashtable...totally misses the point.