D has become unbearable and it needs to stop

Adam D Ruppe destructionator at gmail.com
Thu Jun 8 15:21:46 UTC 2023


On Thursday, 8 June 2023 at 15:00:04 UTC, Steven Schveighoffer 
wrote:
> In this case, `__traits(getAttributes)` was *wrong*, so a bug 
> is being fixed. How do we fix bugs like this without using 
> deprecations and eventual removal?

The problem is that there is no easy migration path for the cases 
where it actually did work just fine. The update required an 
extra static if branch added to each use for a generic loop.

Moreover, a loop over overloads *still* required an additional 
getOverload since the deprecation message triggers in cases when 
it shouldn't have!

foreach(idx, overload; AliasSeq!(__traits(getOverloads, Module, 
memberName))) static if(.isScriptable!
         (__traits(getAttributes, __traits(getOverloads, Module, 
memberName)[idx]))()) { // lol  i have to do the second 
getOverload to stop the compiler from deprecating


The `overload` there wouldn't work despite it already being 
drilled down, since the deprecation wasn't smart enough to see I 
had already handled that case!

Pointless nagging from the compiler that led to worse code, not 
any bug fix.


More information about the Digitalmars-d mailing list