Reimplementing the bulk of std.meta iteratively
Steven Schveighoffer
schveiguy at gmail.com
Tue Sep 29 12:55:36 UTC 2020
On 9/29/20 8:02 AM, 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.
AA is not that far from being a library type.
If you discount the magic casting that AAs can do (which isn't all that
useful), there is one (yes ONE) feature that AAs do that a library type
cannot. And that is an implicit adding of an element in certain cases.
The reason AAs can do it is because the compiler calls a different
opIndex (it's not called opIndex, but some extern(C) hook) when it's in
this mode, but only for AAs.
In fact, AAs are mostly already a library type, thanks to a lot of
incremental effort over the years to lower the implementation to
templates. Except for this one thing.
-Steve
More information about the Digitalmars-d
mailing list