Could we reserve void[T] for builtin set of T ?
matovitch via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 1 05:57:12 PDT 2016
On Friday, 1 April 2016 at 12:45:23 UTC, Jonathan M Davis wrote:
> On Friday, April 01, 2016 19:26:46 Daniel Murphy via
> Digitalmars-d wrote:
>> On 1/04/2016 6:24 AM, deadalnix wrote:
>> > Pretty much as per title. I has that in the back of my mind
>> > for a while. Would that work ?
>>
>> Don't forget that builtin AAs have been an epic disaster, and
>> this would require an appalling amount of effort to implement
>> in the compiler types, ctfe, druntime, new traits etc.
>>
>> Phobos seems like a better place - and while not quite as
>> concise, the syntax should still be pretty intuitive.
>
> Given that we already have built-in AA's, I like the idea of
> adding sets like this, but it wouldn't surprise me at all if it
> were ultimately a bad idea. Certainly, I agree that having AA's
> built into the language has turned into a disaster even though
> it's theoretically very nice to have - and it has turned out
> quite well for the basic use cases. It just falls apart
> completely once you start caring about stuff like const and
> immutable and anything complicated.
>
> As it stands, if someone wants a set with Phobos, we have
> RedBlackTree in std.container. So, we actually have sets
> already. But all of that will presumably be getting an overhaul
> with what Andrei has been up to.
>
> - Jonathan M Davis
I don't know about the implementation of redblack tree in phobos,
but I am willing to bet on a large performance drawback if you
compare it against an optimized hash table (for example using
robin-hood open addressing techniques). And I guess it is for
sorted set (like a heap) with O(log N) insertion and deletion
(although this may be just a theoretical worry)...Furthermore,
the template constraint indicate the need of a less predicate
which you may not need or want to define.
More information about the Digitalmars-d
mailing list