Mixin every entity

Paul Backus snarwin at gmail.com
Thu Jul 25 19:40:49 UTC 2024


On Wednesday, 24 July 2024 at 11:57:35 UTC, Quirin Schroll wrote:
> Mixins can produce types, expressions, statements, and 
> declarations. That is great, but it could be better.
>
> Why not allow mixin identifiers, storage classes, attributes, 
> etc.?

IMO the most impactful addition would be the ability to mixin an 
identifier.

Currently, one of the only use-cases that actually *requires* 
using a string mixin is generating identifiers at compile time. 
The ability to mix in an identifier on its own, without enclosing 
the entire declaration it belongs to in a string mixin, would 
simplify this use-case immensely.

For an example of this use-case in Phobos, see 
[std.typecons.wrap][1].

[1]: https://dlang.org/library/std/typecons/wrap.html


More information about the dip.ideas mailing list