mixin alias

0ffh frank at frankhirsch.youknow.what.todo.net
Sun Dec 16 18:50:12 PST 2007


Derek Parnell wrote:
> Why? If you had such a template (one that used 'side effects') but supplied
> a literal, it would/should fail at the mixin site. I can't see why that
> necessarily prevents the same template being used with non-literals, as
> your example below demonstrates.

You are right.
I had the post retracted, but it seems you've seen it too quick! =)

>> template Foo(alias b)
>> {
>>    int X=(b=4);
>> }
>> [...]
>  mixin Foo!(5) // Should fail because 'int X=(5=4);' is bad syntax.

Yes, as it does for int instead alias, quite right there!

> IMHO, such a template needs *heavy* justification as do all such 'hidden'
> side effects code. Buts that's just the way I think.

I agree, but as it is possible it would still have to be considered.

regards, frank


More information about the Digitalmars-d-learn mailing list