On Friday, 5 June 2015 at 14:23:15 UTC, Steven Schveighoffer wrote:
On 6/5/15 10:15 AM, Dennis Ritchie wrote:

Thanks. It looks really simple, but I still do not understand the
concept of using mixins in full.

I do not understand why in this line:
return `writefln("mode ` ~ mode ~ `: %s", ` ~ value ~ `);`;

use the following syntax:
~ mode ~ , ~ value ~

Because what foo is constructing is a string that makes sense in the *caller*, not inside foo. What those statements do is concat the *value* of mode (i.e. "Y" or "X") and the *value* of value (i.e. "3" or "2") to the string.

It's equivalent to rust using the ${e} to do variable substitution.

Thank you. Now everything is clear. Syntax `${e}` in Rust simpler than D ` ~ substitute the value ~ ` :)

Reply via email to