Re: Why can't I assign a mixin to an alias?

2016-06-12 Thread Dechcaudron via Digitalmars-d-learn
On Saturday, 11 June 2016 at 01:53:10 UTC, David Nadlinger wrote: This might be a gratuitous grammar restriction. There are a few of those surrounding alias "targets". A template that simply returns its parameter might work, though, such as std.meta.Alias (alias foo = Alias!(mixin(…));). It

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread Alex Parrill via Digitalmars-d-learn
On Saturday, 11 June 2016 at 02:46:00 UTC, Adam D. Ruppe wrote: On Saturday, 11 June 2016 at 02:33:46 UTC, Alex Parrill wrote: Mixins are statements. No, they're not. Well, yes they are [1], but there are also mixin expressions [2]. Not to be confused with the TemplateMixin[3], which is

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 11 June 2016 at 02:33:46 UTC, Alex Parrill wrote: Mixins are statements. No, they're not. Well, yes they are [1], but there are also mixin expressions [2]. Not to be confused with the TemplateMixin[3], which is indeed always a statement. 1:

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 10 June 2016 at 22:38:29 UTC, Dechcaudron wrote: I have the following code: private string getVariableSignalWrappersName(VarType)() { return VarType.stringof ~ "SignalWrappers"; } void addVariableListener(VarType)(int variableIndex, void delegate(int, VarType)) { alias

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 10 June 2016 at 22:38:29 UTC, Dechcaudron wrote: Error: basic type expected, not mixin Why should it be like that? I believe the compiler should not impose restrictions on what mixins can or cannot do :/ This might be a gratuitous grammar restriction. There are a few of those

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread Mihail-K via Digitalmars-d-learn
On Friday, 10 June 2016 at 22:38:29 UTC, Dechcaudron wrote: I have the following code: private string getVariableSignalWrappersName(VarType)() { return VarType.stringof ~ "SignalWrappers"; } void addVariableListener(VarType)(int variableIndex, void delegate(int, VarType)) { alias

Why can't I assign a mixin to an alias?

2016-06-10 Thread Dechcaudron via Digitalmars-d-learn
I have the following code: private string getVariableSignalWrappersName(VarType)() { return VarType.stringof ~ "SignalWrappers"; } void addVariableListener(VarType)(int variableIndex, void delegate(int, VarType)) { alias typeSignalWrappers =