mixin identifiers concept
Patrick Schluter
Patrick.Schluter at bbox.fr
Wed Feb 2 14:10:05 UTC 2022
On Wednesday, 2 February 2022 at 13:13:13 UTC, Ola Fosheim
Grøstad wrote:
> On Wednesday, 2 February 2022 at 12:24:32 UTC, Nick Treleaven
> wrote:
>> String interpolation would be pretty much just as bad for
>> performance because it still requires the entire declaration
>> to be put in a string, rather than just an identifier. That
>> whole string needs to be formatted and turned into code, when
>> we'd rather be reading code in the first place!
>
> If you have to use a *mixin* for an identifier on a regular
> basis then that suggests to me that something is wrong with the
> design of the application or that some other language feature
> is missing.
>
> *mixin* should be viewed as an emergency escape hatch
> compenstating for language deficiencies, not as a solution.
Yes, exactly. Mixin variable names as used here is imho a code
smell. The variables are parametrized by a name and that is
probably better solved by an array indexed on an enum, or a
structure or even by an associative array.
More information about the Digitalmars-d
mailing list