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?
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.
Anonymous: I see. C++ first it is.