Calling functions using mixins
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri May 1 15:41:03 PDT 2015
On Friday, 1 May 2015 at 21:50:51 UTC, anonymous wrote:
> What's that supposed to do?
Excuse me, what is not said. I thought that my wish will be
obvious.
On Friday, 1 May 2015 at 21:59:31 UTC, Ali Çehreli wrote:
> On 05/01/2015 02:41 PM, Dennis Ritchie wrote:
>
> > immutable string[] s = [ "foo", "bar" ];
> >
> > writeln(mixin(`format("%(%s, %)", s)`));;
>
> If you are trying to call those functions, remove the double
> quotes by %-(, and use %| to specify what is a delimiter. To
> call, each needs a semicolon:
>
> mixin(format("%-(%s();%| %)", s));
>
> If you wanted to print the results of calling those functions,
> then, yes, use a comma. Also, I think you need to put "writeln"
> inside as well:
>
> mixin(format("writeln(%-(%s(), %));", s));
>
> Ali
Thanks. Yes, I wanted to print the results of calling these
functions.
More information about the Digitalmars-d-learn
mailing list