Phobos 3 Discussion Notes - 02-01-2024

Meta jared771 at gmail.com
Mon Feb 5 02:23:15 UTC 2024


On Sunday, 4 February 2024 at 09:30:58 UTC, Jonathan M Davis 
wrote:
> The advantage of that is that the result is cleaner code (since 
> __traits tends to be pretty ugly), but it also means more 
> template instantiations. So, I expect that there is going to be 
> some disagreement on what we should be doing there

Man this is such an easily-fixable problem. I wish Walter weren't 
so stubborn about having macros in D. All it would take is 
something like:

```
macro template isNumeric(T) {
     __traits(isNumeric, T)
}

enum isStringNumeric = isNumeric!String;
assert(!isStringNumeric);
```

No symbol template instantiation or symbol generation necessary. 
It's like mixin templates but in reverse. Constrain macro 
templates to only be allowed to expand to an expression or 
something. It completely fixes any issues with std.traits, and is 
probably useful in a lot more areas as well.



More information about the Digitalmars-d mailing list