opMixin or mixin function templates with convenience operator?
Paul Backus
snarwin at gmail.com
Thu Dec 12 23:13:42 UTC 2019
On Thursday, 12 December 2019 at 22:25:25 UTC, Ola Fosheim
Grøstad wrote:
> On Thursday, 12 December 2019 at 22:17:59 UTC, Paul Backus
> wrote:
>> If what you actually want is a pure const lambda, there's
>> nothing stopping you from writing one and sticking your mixin
>> inside it.
>
> Just basic software engineering. No external entity should be
> able to access anything in the calling context that has not
> been explicitly exported.
>
> It does not scale well as it can lead to bugs that are hard to
> locate.
>
> So, it is an attempt to mitigate the problematic "macro" aspect
> of mixins and make the construct hygenic.
I agree, which I why I try to use string mixins in my own code as
little as possible.
Nevertheless, it is occasionally very useful to be able to do
unhygienic macro-like things. If it were up to me, I'd add AST
macros to D and use those, but as it is, string mixins are the
only available tool for the job. I would very much prefer not to
have that tool taken away, sharp though it may be.
More information about the Digitalmars-d
mailing list