First Impressions!
docandrew
x at x.com
Tue Nov 28 03:29:04 UTC 2017
On Tuesday, 28 November 2017 at 03:01:33 UTC, A Guy With an
Opinion wrote:
>
> - ...however, where are all of the collections? No Queue? No
> Stack? No HashTable? I've read that it's not a big focus
> because some of the built in stuff *can* behave like those
> things. The C# project I'm porting utilizes queues and a
> specifically C#'s Dictionary<> quite a bit, so I'm not looking
> forward to having to hand roll my own or use something that
> aren't fundamentally them. This is definitely the biggest
> negative I've come across. I want a queue, not something that
> *can* behave as a queue. I definitely expected more from a
> language that is this old.
>
Good feedback overall, thanks for checking it out. You're not
wrong, but some of the design decisions that feel strange to
newcomers at first have been heavily-debated, generally
well-reasoned, and just take some time to get used to. That
sounds like a cop-out, but stick with it and I think you'll find
that a lot of the decisions make sense - see the extensive
discussion on NaN-default for floats, for example.
Just one note about the above comment though: the
std.container.dlist doubly-linked list has methods that you can
use to put together stacks and queues easily:
https://dlang.org/phobos/std_container_dlist.html
Also, D's associative arrays implement a hash map
https://dlang.org/spec/hash-map.html, which I think should take
care of most of C#'s Dictionary functionality.
Anyhow, D is a big language (for better and sometimes worse), so
it's easy to miss some of the good nuggets buried within the
spec/library.
-Doc
More information about the Digitalmars-d
mailing list