opMixin or mixin function templates with convenience operator?

Simen Kjærås simen.kjaras at gmail.com
Fri Dec 13 12:37:31 UTC 2019


On Thursday, 12 December 2019 at 22:02:22 UTC, Ola Fosheim 
Grøstad wrote:
> On Thursday, 12 December 2019 at 21:40:33 UTC, Paul Backus 
> wrote:
>> Is there any actual difference between mixing in a bare 
>> expression vs. an immediately-called lambda function that 
>> evaluates to the same expression? Forcing string mixins to 
>> represent lambdas in particular seems needlessly restrictive.
>
> The idea is to prevent writing to variables outside the mixin. 
> So, @pure and const params would perhaps be enough to enable 
> that?

So interpolate#"{foo++}" should fail to compile? As should 
interpolate#"{foo}" where foo is of a type with a non-const 
toString()?

I see what you're trying to do, but IMO there are too many cases 
where the outlined restrictions cause undue problems.

--
   Simen


More information about the Digitalmars-d mailing list