Reimplementing the bulk of std.meta iteratively
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Sep 29 14:07:14 UTC 2020
On 9/29/20 9:38 AM, bachmeier wrote:
> On Tuesday, 29 September 2020 at 12:02:21 UTC, Patrick Schluter wrote:
>
>> Your AA example is a good one. If it wasn't in the language, it would
>> be the same issue with AA as in any other language that defines it in
>> libraries: several different incompatible restricted implementations.
>
> That's a good example. IMO there's a difference between a language and
> bits and pieces that can be put together to call random libraries.
There is no doubt to Walter or myself that the way built-in AAs were
done in D is a resounding failure.
The way they should have been done was a templated library type
AssociativeArray!(K, V) with the V[K] type syntax sugar on top. That
would have allowed the implementation to improve along with the rest of
the language and its library.
(Of course there's historical context to this, i.e. AAs predate
templates and then they just continued being there, increasingly
standing out like the proverbial sore thumb as everything else evolved
around them.)
As things are now, AAs don't quite behave like any other things. They
are a poor cousin to ranges. No container infrastructure grew around
them. They are dramatically less efficient than library hashtables.
Worst of all, these problems have been well-known for years and years
and the progress on fixing them has moved at a glacial pace.
More information about the Digitalmars-d
mailing list