What do you thing about this string interpolation idea
Jonathan Marler
johnnymarler at gmail.com
Mon Dec 10 18:37:53 UTC 2018
On Monday, 10 December 2018 at 18:35:16 UTC, Daniel Kozak wrote:
> I do not see any problem with add one line in every function.
> Right now I
> do much more of this with imports so I can live with that.
> And there is a easy solution to fix Jonathan issue. Just do not
> use it on
> global scope. You can force it to be used only on function
> scope and so on.
>
> But obviosly it is still a hack and workaround about something
> what should be in a language anyway.
>
> On Mon, Dec 10, 2018 at 7:30 PM aliak via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
>
>> On Monday, 10 December 2018 at 16:45:30 UTC, Steven
>> Schveighoffer wrote:
>> > The benefit is that you only have to mixin once, whereas the
>> > usage does not require a mixin. It just goes next to your
>> > import statements.
>>
>> Once per *every* function you want to use it in. Not sure I see
>> the benefit actually 🤷♂️ Jonathan also brings up a very good
>> point. Hello bugs.
>>
>> Cheers,
>> - Ali
It's not just global scope, it's any outer scope. Examples:
class
{
mixin(enableInterpolate); // BAD
void foo()
{
interpolate!(...)
}
}
void foo2()
{
mixin(enableInterpolate); // BAD
void inner_foo()
{
interpolate!(...)
}
}
More information about the Digitalmars-d
mailing list