Update on the D-to-Jai guy: We have real problems with the language

Walter Bright newshound2 at digitalmars.com
Tue Nov 29 07:15:25 UTC 2022


On 11/27/2022 1:29 AM, FeepingCreature wrote:
> 3. But also if we're talking about number of instantiations, `hasUDA` and 
> `getUDA` lead the pack. I think the way these work is just bad - I've rewritten 
> all my own `hasUDA`/`getUDA` code to be of the form `udaIndex!(U, 
> __traits(getAttributes, T))` - instantiating a unique copy for every combination 
> of field and UDA is borderline quadratic - but that didn't help much even though 
> `-vtemplates` hinted that it should. `-vtemplates` needs compiler time 
> attributed to template recursively.

hasUDA and getUDAs are defined:


enum hasUDA(alias symbol, alias attribute) = getUDAs!(symbol, attribute).length 
!= 0;

template getUDAs(alias symbol, alias attribute)
{
     import std.meta : Filter;

     alias getUDAs = Filter!(isDesiredUDA!attribute, __traits(getAttributes, 
symbol));
}


These do look pretty inefficient. Who wants to fix Phobos with FeepingCreature's 
solution?


More information about the Digitalmars-d mailing list