named arguments, string interpolation, please stop.

zjh fqbqrr at 163.com
Fri Jan 12 02:31:21 UTC 2024


On Friday, 12 January 2024 at 01:21:32 UTC, H. S. Teoh wrote:
> On Fri, Jan 12, 2024 at


```d
void registerCallbackSystem(void delegate() @system cb) @system;
void registerCallbackSafe(void delegate() @safe cb) @safe;
...
```
I think `'abstract attributes'` is also a good idea. Can we turn 
the above function into:
```d
bool @attribute f(set b){
     return b.hasone(@system);
}

void registerCallback(void delegate() cb) @safe{
     static if(f(attrs(cb))){
         ...
     }
     static if(attrs(cb)==@nogc){
         ...
     }
     ...
}
```
Combining `attribute functions` to avoid `function splitting`.



More information about the Digitalmars-d mailing list