What's the deal with the massive duplication in std.meta?
Q. Schroll
qs.il.paperinik at gmail.com
Tue May 4 18:27:59 UTC 2021
On Tuesday, 4 May 2021 at 18:19:10 UTC, Q. Schroll wrote:
> On Tuesday, 4 May 2021 at 17:45:53 UTC, Paul Backus wrote:
>> On Tuesday, 4 May 2021 at 17:39:54 UTC, Q. Schroll wrote:
>>> On Tuesday, 4 May 2021 at 16:54:13 UTC, Andrei Alexandrescu
>>> wrote:
>>>> I put together a bunch other related pull requests:
>>>>
>>>> https://github.com/dlang/phobos/pulls/andralex
>>>>
>>>> Using alias assignment with good measure leads to much
>>>> simpler and clearer code. I also measured memory consumption
>>>> improvements, but for the Phobos unittest they are not
>>>> dramatic.
>>>
>>> Is there some resource where the rules for alias assignments
>>> are spelled out? Googling '"alias assignment" site:dlang.org'
>>> produces no meaningful results. Having procedural aspects in
>>> a declarative space looks a bit odd to me. The change logs
>>> revealed nothing.
>>
>> There's an open spec PR:
>>
>> https://github.com/dlang/dlang.org/pull/2919
>
> How does something like this not require a DIP?
For example, `staticMap` can be implemented iteratively like this:
```D
alias staticMap(alias f, args...) = mixin(() {
string result = "AliasSeq!(";
static foreach (i; 0 .. args.length)
result ~= mixin(`"f!(args[`, i, `])"`);
return result ~ ")";
}());
```
I agree it leads to simpler code. I just don't know if it's worth
it.
More information about the Digitalmars-d
mailing list