myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread tsalm
Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Ellery Newcomer
tsalm wrote: Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm Something like this might work: class MyClass{ int[] stuff; alias add opCall; MyClass add(int k){ stuff ~= k; return this; } }

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Denis Koroskin
On Wed, 10 Dec 2008 02:40:47 +0300, tsalm <[EMAIL PROTECTED]> wrote: Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm Yes: import std.stdio; class MyClass { class MyClassAdder { MyClassAdder

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread BCS
Reply to TSalm, Hello, How to implement an object that can do this : myClass.add(something)(otherthings)(thisToo); Is it possible ? TIA, TSalm if you don't mind dropping the )( class C { final void add(T...)(T t) { foreach(int i,_;T) _ad

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Jarrett Billingsley
On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: > class C > { > final void add(T...)(T t) > { > foreach(int i,_;T) > _add(t[i]); > } > //. > } > > > (new C).add(something, otherthings, thisToo); If all the params are the same type, typesafe variadics are

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread Denis Koroskin
On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]> wrote: On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: class C { final void add(T...)(T t) { foreach(int i,_;T) _add(t[i]); } //. } (new C).add(something, otherthings, thisT

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-09 Thread tsalm
Le Wed, 10 Dec 2008 03:16:49 +0100, Denis Koroskin <[EMAIL PROTECTED]> a écrit: On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]> wrote: On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: class C { final void add(T...)(T t) { foreach(int i,_

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-10 Thread BCS
Reply to Denis, On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]> wrote: On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: final void add(T...)(T t) If all the params are the same type, typesafe variadics are a more efficient/less code-bloaty way to d

Re: myClass.add(something)(otherthings)(thisToo);

2008-12-10 Thread Denis Koroskin
On Wed, 10 Dec 2008 19:31:47 +0300, BCS <[EMAIL PROTECTED]> wrote: Reply to Denis, On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <[EMAIL PROTECTED]> wrote: On Tue, Dec 9, 2008 at 7:00 PM, BCS <[EMAIL PROTECTED]> wrote: final void add(T...)(T t) If all the params are the same ty