July 20, 2014
> mixin template Vala2(uint count, alias arr) {

What about disallowing "mixin templatename" unless you add "mixin" before the "template" keyword?

Bye,
bearophile
July 20, 2014
On Sunday, 20 July 2014 at 15:54:15 UTC, bearophile wrote:
>> mixin template Vala2(uint count, alias arr) {
>
> What about disallowing "mixin templatename" unless you add "mixin" before the "template" keyword?
>
> Bye,
> bearophile

I do not understand?
July 20, 2014
Foo:

> I do not understand?

Sorry, mine was a language design question (to catch your bug).

Bye,
bearophile
July 20, 2014
On Sunday, 20 July 2014 at 15:54:15 UTC, bearophile wrote:
>> mixin template Vala2(uint count, alias arr) {
>
> What about disallowing "mixin templatename" unless you add "mixin" before the "template" keyword?
>
> Bye,
> bearophile

I thought it's disallowed.
July 20, 2014
On Sunday, 20 July 2014 at 15:02:58 UTC, Foo wrote:
> On Sunday, 20 July 2014 at 14:55:00 UTC, Foo wrote:
>> For clarification: how would that work without mixin + string?
>
> I tried this:
>
> mixin template Vala2(uint count, alias arr) {
> 	asm {
> 		sub ESP, count;
> 		mov arr, count;
> 		mov arr + 4, ESP;
> 	}
> }
>
> but I get several errors. Unfortunately it seems that asm cannot be used in mixin templates?!

The reason may be that mixin templates are just for inserting declarations, which asm blocks aren't. This limitation isn't specific to asm.
July 21, 2014
On Sunday, 20 July 2014 at 17:50:10 UTC, Nicolas Sicard wrote:
> On Sunday, 20 July 2014 at 15:02:58 UTC, Foo wrote:
>> On Sunday, 20 July 2014 at 14:55:00 UTC, Foo wrote:
>>> For clarification: how would that work without mixin + string?
>>
>> I tried this:
>>
>> mixin template Vala2(uint count, alias arr) {
>> 	asm {
>> 		sub ESP, count;
>> 		mov arr, count;
>> 		mov arr + 4, ESP;
>> 	}
>> }
>>
>> but I get several errors. Unfortunately it seems that asm cannot be used in mixin templates?!
>
> The reason may be that mixin templates are just for inserting declarations, which asm blocks aren't. This limitation isn't specific to asm.

But what's the reason for that?
1 2
Next ›   Last »