alias c=mixin(expr); disallowed, why?

Timothee Cour thelastmammoth at gmail.com
Sat Jun 22 15:05:53 PDT 2013


On Sat, Jun 22, 2013 at 2:55 PM, Timon Gehr <timon.gehr at gmx.ch> wrote:

> On 06/22/2013 11:51 PM, Timothee Cour wrote:
>
>>
>>
>> On Sat, Jun 22, 2013 at 2:47 PM, Timon Gehr <timon.gehr at gmx.ch
>> <mailto:timon.gehr at gmx.ch>> wrote:
>>
>>     On 06/22/2013 09:52 PM, Timothee Cour wrote:
>>
>>         Is there a reason the language spec disallows this?
>>
>>         ----
>>         void main(){
>>              auto a=mixin("1");//OK
>>              alias b=a;//OK
>>              mixin("alias c=a;");//OK
>>              // alias c=mixin("a");//NG : Error: basic type expected,
>>         not mixin
>>         }
>>         ----
>>
>>
>>     No, it is arbitrary.
>>
>>
>> that's what i thought!
>> same with template mixin's being restricated.
>>
>>
> ?
>
>
they're restricted to declarations. I don't see the need for such
restriction.



>  ... can we fix it?
>>
>> it makes for cleaner code.
>>
>>
> It surely could be fixed if you want to spend the time hacking on DMD.
> I think the grammar is somewhat poorly designed in general.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130622/8129f432/attachment.html>


More information about the Digitalmars-d-learn mailing list