Associative arrays

Chris Piker chris at hoopjump.com
Tue May 18 09:14:46 UTC 2021


On Tuesday, 18 May 2021 at 08:22:56 UTC, Ola Fosheim Grostad 
wrote:
> The main reason is that D needs better metaprogramming.

That's an interesting take.

So far, with only a month's usage of D I'm seeing so much 
meta-programming capability that it actually worries me a bit.  
With string mixins and so many other meta programming features 
around I'm starting to think that reading other people's D code 
is going to be quite difficult, similar to perl.

> Golden design rule: never add language features that can be 
> done as library constructs, ever.

This sounds like a reasonable position.  Imagine for a second 
that AAs were implemented as a library.  What would the library 
equivalent of this:

```d
long[string] aa = ["foo": 5, "bar": 10, "baz": 2000 ];
```

look like?




More information about the Digitalmars-d mailing list