Right after allocators: containers or database connectivity?

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 16:29:32 PDT 2015


On Tuesday, 9 June 2015 at 22:05:27 UTC, Jonathan M Davis wrote:
> [snip]
>> I think RedBlackTree isn't a very good name though. It's long 
>> and is an implementation detail.
>
> The decision was previously made to name the containers after 
> what they actually are rather than what they're used for, and I 
> still agree with that decision. However, I do think that we 
> should have wrappers and aliases where appropriate (e.g. 
> SortedMap could be an alias to RedBlackTree, and SortedSet 
> could be a wrapper around RedBlackTree) in order to provide 
> names which are based on what you use them for (rather than 
> what they are) as folks frequently expectA nd in some cases 
> (like SortedSet), it's pretty much necessary unless you have a 
> lot of code duplication, since the same data structure is used 
> for multiple container types, but the API needs to be slightly 
> different to be truly user-friendly.

I suppose an alias would be fine. I can't think of any other 
standard library that uses the actual data structures as the 
names. Doing it that way exclusively would be unfriendly to 
newcomers and downright hostile to people who never have (or have 
yet to) study computer science.

Thinking about it more I actually like the idea now of naming 
them by the data structure and using aliases. That would also 
open the possibility of relegating more sophisticated template 
argument container configuration options (bucket sizes, 
sparse/dense, etc.) to the data structure to which they apply and 
letting the container concept aliases be a sane default.


More information about the Digitalmars-d mailing list