Re: Calling functions using mixins

2015-05-01 Thread Dennis Ritchie via Digitalmars-d-learn
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 = [

Calling functions using mixins

2015-05-01 Thread Dennis Ritchie via Digitalmars-d-learn
hi, Is it possible to call functions using mixins in this way? - import std.stdio; int fooTestMixin() { return 5; } void main() { enum t { fooTestMixin }; immutable string[] strArr = [ fooTestMixin ]; writeln(mixin(`mixin(t.fooTestMixin)`));

Re: Calling functions using mixins

2015-05-01 Thread anonymous via Digitalmars-d-learn
On Friday, 1 May 2015 at 21:04:10 UTC, Dennis Ritchie wrote: hi, Is it possible to call functions using mixins in this way? - import std.stdio; int fooTestMixin() { return 5; } void main() { enum t { fooTestMixin }; immutable string[] strArr = [ fooTestMixin ];

Re: Calling functions using mixins

2015-05-01 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 1 May 2015 at 21:26:20 UTC, anonymous wrote: On Friday, 1 May 2015 at 21:04:10 UTC, Dennis Ritchie wrote: hi, Is it possible to call functions using mixins in this way? - import std.stdio; int fooTestMixin() { return 5; } void main() { enum t { fooTestMixin };

Re: Calling functions using mixins

2015-05-01 Thread anonymous via Digitalmars-d-learn
On Friday, 1 May 2015 at 21:41:10 UTC, Dennis Ritchie wrote: My final goal is to do something like this: - import std.stdio, std.string; int foo() { return 5; } int bar() { return 10; } void main() { immutable string[] s = [ foo, bar ];

Re: Calling functions using mixins

2015-05-01 Thread Ali Çehreli via Digitalmars-d-learn
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: