On Sunday, 3 August 2014 at 13:27:40 UTC, Rikki Cattermole wrote:
On 4/08/2014 12:30 a.m., Bayan Rafeh wrote:
On Sunday, 3 August 2014 at 11:56:32 UTC, Rikki Cattermole wrote:
On 3/08/2014 11:53 p.m., Bayan Rafeh wrote:
Small question. Can anyone give me an example of when one would use a parametrized block as opposed to a parameterized class or method?

mixin templates take the context for which they are mixed in. Basically:


mixin template FooT() {
   void FooT() {
       //...
       writeln(bar);
   }
}

void myfunc() {
   string bar;
   //...
   mixin FooT;
}

Templated classes/structs/unions/method or functions are used for if
you want to modify code gen itself.

I'm not sure if we're going to be using templates much so I'm going to include a couple of examples you gave, plus the link that Gary posted which is better than anything I could write right now. Do you think
that's enough?

If you're using writeln, you're using templates. Pretty much, once you start using them, you'll realize inherently how powerful they are. That's why I believe it should be more then just touched upon :)

Very well then. I will try my best to do them justice.

And I see what you mean with the with statement. It certainly is an intriguing concept, and I would love to see something like that.

It's quite underused. It'll be quite exciting to see it being actually used in frameworks.

I'll add it in there on the off chance that someone designing a framework will stumble upon this tutorial and make use of if.

Anonymous: I see. C++ first it is.

Reply via email to