Re: changing array lengths

2008-12-10 Thread Derek Parnell
On Tue, 09 Dec 2008 22:54:30 -0600, Ellery Newcomer wrote: Does the following totally not make sense? I think it should work. int[] a = new int[10]; a.length += 30; Unfortunately, the .length property, like all properties, do not support the 'op=' syntax. You have to do it the long way

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 do

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 type,

Re: isExist in associate array

2008-12-10 Thread Spacen Jasset
Ellery Newcomer wrote: raymond wrote: how to check if array key exist in array or not? for example char[] [char[]] t; t[tes1]=val1; t[tes2]=val2; t[tes3]=val3; if (t[test1]) writefln(NONE); if(test1 in t) writefln(exists); Also useful: char[] value; if ( (value = test1

Re: static initialization question

2008-12-10 Thread Jarrett Billingsley
On Wed, Dec 10, 2008 at 5:31 PM, Weed [EMAIL PROTECTED] wrote: code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c = new MyClass; writeln( c.a ); } It's not the class member that wants static initialization, it's your variable

Re: static initialization question

2008-12-10 Thread BCS
Reply to Jarrett, On Wed, Dec 10, 2008 at 5:31 PM, Weed [EMAIL PROTECTED] wrote: code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c = new MyClass; writeln( c.a ); } It's not the class member that wants static initialization, it's your variable

Re: static initialization question

2008-12-10 Thread Weed
Denis Koroskin пишет: On Thu, 11 Dec 2008 01:31:32 +0300, Weed [EMAIL PROTECTED] wrote: But my class does not contain data that need initialization and can be created in compile time code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c =

Re: static initialization question

2008-12-10 Thread Weed
Jarrett Billingsley пишет: On Wed, Dec 10, 2008 at 5:31 PM, Weed [EMAIL PROTECTED] wrote: code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c = new MyClass; writeln( c.a ); } It's not the class member that wants static initialization,

Re: static initialization question

2008-12-10 Thread Denis Koroskin
On Thu, 11 Dec 2008 02:13:58 +0300, Weed [EMAIL PROTECTED] wrote: Denis Koroskin пишет: On Thu, 11 Dec 2008 01:31:32 +0300, Weed [EMAIL PROTECTED] wrote: But my class does not contain data that need initialization and can be created in compile time code: import std.stdio; class MyClass