On Sat, 28 Apr 2012 22:40:10 +0200, Artur Skawina <[email protected]> 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!();
}

Reply via email to