On Friday, 29 July 2016 at 18:39:23 UTC, Jesse Phillips wrote:
On Friday, 29 July 2016 at 18:34:56 UTC, Jesse Phillips wrote:
Here the generateCode() is mixed in to the context of foo(),
which is fine if your code is performing actions but is no
good if you're creating declarations that you wan
On Friday, 29 July 2016 at 18:34:56 UTC, Jesse Phillips wrote:
Here the generateCode() is mixed in to the context of foo(),
which is fine if your code is performing actions but is no good
if you're creating declarations that you want to use in the
context of main().
Here is a fully functionin
D won't let you hide the mixin, the keyword is there specifically
to indicate code is being injected in that location.
This isn't what you are looking for, but you can do something
like this:
-
string generateCode(string s){return "";}
void main()
{
enum s = "
On Friday, 29 July 2016 at 12:22:54 UTC, Andre Pany wrote:
It is more or less syntax sugar. In the main function instead
of writing "mixin(generateCode(s));" I want to write "foo(s);".
So, the mixin statement is hidden while the functionality of
mixin stays.
Kind regards
André
As far as I k
On 7/29/16 2:38 AM, Andre Pany wrote:
Hi,
is there a way to alias a string mixin?
Neither foo nor foo2 compiles.
import std.meta : Alias;
alias foo = (s) => Alias!(mixin(generateCode(s)));
s is a runtime parameter. You can't mixin stuff that is only available
at runtime.
alias foo2(string
On Friday, 29 July 2016 at 12:11:44 UTC, pineapple wrote:
On Friday, 29 July 2016 at 06:38:17 UTC, Andre Pany wrote:
Hi,
is there a way to alias a string mixin?
Neither foo nor foo2 compiles.
import std.meta : Alias;
alias foo = (s) => Alias!(mixin(generateCode(s)));
alias foo2(string s) = Ali
On Friday, 29 July 2016 at 06:38:17 UTC, Andre Pany wrote:
Hi,
is there a way to alias a string mixin?
Neither foo nor foo2 compiles.
import std.meta : Alias;
alias foo = (s) => Alias!(mixin(generateCode(s)));
alias foo2(string s) = Alias!(mixin(generateCode(s)));
string generateCode(string s)
On 29/07/2016 6:38 PM, Andre Pany wrote:
Hi,
is there a way to alias a string mixin?
Neither foo nor foo2 compiles.
import std.meta : Alias;
alias foo = (s) => Alias!(mixin(generateCode(s)));
alias foo2(string s) = Alias!(mixin(generateCode(s)));
string generateCode(string s){return "";}
void
Hi,
is there a way to alias a string mixin?
Neither foo nor foo2 compiles.
import std.meta : Alias;
alias foo = (s) => Alias!(mixin(generateCode(s)));
alias foo2(string s) = Alias!(mixin(generateCode(s)));
string generateCode(string s){return "";}
void main()
{
enum s = "a = 2 + 3; b = 4 + a