The state of string interpolation

Mike Franklin slavo5150 at yahoo.com
Fri Dec 7 05:18:33 UTC 2018


On Friday, 7 December 2018 at 03:00:54 UTC, Adam D. Ruppe wrote:
> On Friday, 7 December 2018 at 02:38:30 UTC, Mike Franklin wrote:
>>> We kinda-sorta can, with `lazy void`.
>>
>> I'm not sure what you mean.  Please elaborate.
>
> It is the runtime version of what Steven gave.
>
> void foo(lazy int something) {
>    import std.stdio;
>    writeln(something);
> }
>
> void main() {
>   int a = 1, b = 2;
>   foo(a + b);
> }
>
>
> And you can `lazy void` too, which takes anything which has an 
> effect (it is an error if it has no effect), but discards its 
> return value. example here: 
> https://dlang.org/spec/function.html#lazy-params

It's stuff like this that makes D so cool; I wasn't aware of this 
feature.  Thanks, Adam, I totally get it now.


More information about the Digitalmars-d mailing list