Does D have too many features?

Simen Kjaeraas simen.kjaras at gmail.com
Sun Apr 29 17:33:48 PDT 2012


On Sat, 28 Apr 2012 22:40:10 +0200, Artur Skawina <art.08.09 at gmail.com>  
wrote:

> On 04/28/12 22:02, Walter Bright wrote:
>> On 4/28/2012 12:36 PM, Andrej Mitrovic wrote:
>>> Also there's mixin templates. What exactly is the difference between
>>> mixin templates and regular templates?
>>
>> A mixin template is instantiated in context of the instantiation point,  
>> while a regular template is instantiated in the context of the template  
>> definition point.
>>
>> This becomes relevant when looking up symbols that are not defined  
>> within the template.
>
> Yeah, but this was actually the only suggestion so far in this thread  
> that
> i could agree with... The issue is
>
>    template t1() { int a = b; }
>    int main() { int b; mixin t1; return a; }
>
> which is currently accepted - and would enforcing the mixin annotation
> really help anything?
>
> artur

At least some of us want mixin templates to be marked mixin at declaration
point, and usable without 'mixin':

mixin template A( ) {
     int n;
}

struct S {
     A!();
}


More information about the Digitalmars-d mailing list