Mixin a constructor ?

2009-09-19 Thread Jacob Carlborg
Is it supposed to possible to mixin a constructor? The code below doesn't compile. The error: is "main.d(23): Error: constructor main.A.this() does not match parameter types (int) main.d(23): Error: expected 0 arguments, not 1" template C () {

Re: Mixin a constructor ?

2009-09-19 Thread dsimcha
== Quote from Jacob Carlborg (d...@me.com)'s article > Is it supposed to possible to mixin a constructor? The code below > doesn't compile. The error: is "main.d(23): Error: constructor > main.A.this() does not match parameter types (int) > main.d(23): Error:

Re: Mixin a constructor ?

2009-09-19 Thread Christopher Wright
Jacob Carlborg wrote: Is it supposed to possible to mixin a constructor? The code below doesn't compile. The error: is "main.d(23): Error: constructor main.A.this() does not match parameter types (int) main.d(23): Error: expected 0 arguments, not 1" A template mixin introdu

Re: Mixin a constructor ?

2009-09-19 Thread BCS
Hello Jacob, Is it supposed to possible to mixin a constructor? The code below doesn't compile. The error: is "main.d(23): Error: constructor main.A.this() does not match parameter types (int) main.d(23): Error: expected 0 arguments, not 1" IIRC mixins can't overload with

Re: Mixin a constructor ?

2009-09-19 Thread Jacob Carlborg
On 9/19/09 20:55, Christopher Wright wrote: Jacob Carlborg wrote: Is it supposed to possible to mixin a constructor? The code below doesn't compile. The error: is "main.d(23): Error: constructor main.A.this() does not match parameter types (int) main.d(23): Error: expected 0 argume

Re: Mixin a constructor ?

2009-09-19 Thread language_fan
>> template C () >> { >> this (int i) >> { >> } >> } >> class A >> { >> mixin C; >> this () >> { >> } >> } >> void main () >> { >> auto a = new A(3); >> } Since the constructor has no meaning outside classes, should it be interpreted as a free function if mixed in a non-class context? I really w

Re: Mixin a constructor ?

2009-09-20 Thread Michel Fortin
On 2009-09-19 21:17:36 -0400, language_fan said: Since the constructor has no meaning outside classes, should it be interpreted as a free function if mixed in a non-class context? I really wonder how this could be valid code. Does the grammar even support the 3rd line? Personally, I'd like it

Re: Mixin a constructor ?

2009-09-20 Thread Ellery Newcomer
language_fan wrote: > Since the constructor has no meaning outside classes, should it be > interpreted as a free function if mixed in a non-class context? I really > wonder how this could be valid code. Does the grammar even support the > 3rd line? Checking whether a constructor is inside a cla

Re: Mixin a constructor ?

2009-09-20 Thread Christopher Wright
Michel Fortin wrote: On 2009-09-19 21:17:36 -0400, language_fan said: Since the constructor has no meaning outside classes, should it be interpreted as a free function if mixed in a non-class context? I really wonder how this could be valid code. Does the grammar even support the 3rd line? P