Re: container class sample on Tango mainpage can not compile

2009-01-10 Thread Moritz Warning
On Wed, 07 Jan 2009 19:47:57 -0500, Sam Hu wrote: > Morning, > > Anybody can help? > > Regards, > Sam try this: auto nameSet=new TreeBag!(char[])(null, (char[] first,char[] second) { return icompare(first,second); } ); btw: tango.collection.* is deprecated and will be

Re: object splitting in multiple threads

2009-01-10 Thread downs
Jarrett Billingsley wrote: > On Sat, Jan 10, 2009 at 12:30 AM, Jarrett Billingsley > wrote: >> On Sat, Jan 10, 2009 at 12:18 AM, yes wrote: >>> Does Phobos also do threadpools? >> From what I understand, not without modification. At least, not >> efficiently. Downs has implemented such a thing

Re: object splitting in multiple threads

2009-01-10 Thread Jarrett Billingsley
On Sat, Jan 10, 2009 at 6:39 AM, downs wrote: > Jarrett Billingsley wrote: >> On Sat, Jan 10, 2009 at 12:30 AM, Jarrett Billingsley >> wrote: >>> On Sat, Jan 10, 2009 at 12:18 AM, yes wrote: Does Phobos also do threadpools? >>> From what I understand, not without modification. At least, no

linking with c

2009-01-10 Thread Mike
So I'm trying to link a C file to be used in a D program: hw.c: #include void hw() { printf("Hello, world!"); } hw_main.d: module hw_main; extern (C) void hw(); int main() { hw(); return 0; } I compile the C file with dmc: dmc -c hw.c and the D file with dmd: dmd

Re: linking with c

2009-01-10 Thread Jason House
Mike wrote: > So I'm trying to link a C file to be used in a D program: > I compile the C file with dmc: dmc -c hw.c > and the D file with dmd: dmd -c hw_main.d I usually keep it simple and do: dmd main.d hw.obj

using a typedefed variable with library classes

2009-01-10 Thread Charles Hixson
Is it possible to use a typedefed variable with library classes? In particular, what I've done is: typedef int TestType; TestType t; File f; t = 42; f.write (t); And the response I get is the compiler asking whether I want to write bytes or a long. Am I doing something grossly wrong

Re: using a typedefed variable with library classes

2009-01-10 Thread Bill Baxter
On Sun, Jan 11, 2009 at 8:23 AM, Charles Hixson wrote: > Is it possible to use a typedefed variable with library classes? > > In particular, what I've done is: > > typedef int TestType; > TestType t; > File f; > > t = 42; > f.write (t); > > And the response I get is the compiler asking whe

Re: using a typedefed variable with library classes

2009-01-10 Thread Charles Hixson
Bill Baxter wrote: On Sun, Jan 11, 2009 at 8:23 AM, Charles Hixson wrote: Is it possible to use a typedefed variable with library classes? In particular, what I've done is: typedef int TestType; TestType t; File f; t = 42; f.write (t); And the response I get is the compiler asking w

Re: using a typedefed variable with library classes

2009-01-10 Thread bearophile
Bill Baxter: > I've never found a use for typedef myself. I don't think it's used much,< In Pascal (and its variant and children, like ObjectPascals, etc) there is a section named Type where you define your typedefs. People used to program in Pascal-like languages (ObjectPascals, Ada, Oberon, e

Re: using a typedefed variable with library classes

2009-01-10 Thread Bill Baxter
On Sun, Jan 11, 2009 at 10:16 AM, bearophile wrote: > Bill Baxter: >> I've never found a use for typedef myself. I don't think it's used much,< > > In Pascal (and its variant and children, like ObjectPascals, etc) there is a > section named Type where you define your typedefs. People used to pro

Foreach problem

2009-01-10 Thread Tim M
Why is this an error. Dmd wants to make sure that I declare a new variable in the foreach statement and not use an existing one? module test; void main() { int i; int[] nums; foreach(i; nums) { // } } dmd test.d test.d(7): Error: sha

Re: Foreach problem

2009-01-10 Thread Daniel Keep
Tim M wrote: Why is this an error. Dmd wants to make sure that I declare a new variable in the foreach statement and not use an existing one? module test; void main() { int i; int[] nums; foreach(i; nums) { // } } dmd test.d test.d(7): Error: shadowing declar

Re: Foreach problem

2009-01-10 Thread Jarrett Billingsley
On Sat, Jan 10, 2009 at 9:33 PM, Tim M wrote: > > Why is this an error. Dmd wants to make sure that I declare a new variable > in the foreach statement and not use an existing one? You can't reuse existing variables as foreach loop indices, long story short.

Re: Foreach problem

2009-01-10 Thread Tim M
On Sun, 11 Jan 2009 15:50:54 +1300, Daniel Keep wrote: Tim M wrote: Why is this an error. Dmd wants to make sure that I declare a new variable in the foreach statement and not use an existing one? module test; void main() { int i; int[] nums; foreach(i; nums) {

Re: Foreach problem

2009-01-10 Thread Tim M
On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: On Sun, 11 Jan 2009 15:50:54 +1300, Daniel Keep wrote: Tim M wrote: Why is this an error. Dmd wants to make sure that I declare a new variable in the foreach statement and not use an existing one? module test; void main() { int i

Re: Foreach problem

2009-01-10 Thread Bill Baxter
On Sun, Jan 11, 2009 at 11:33 AM, Tim M wrote: > > Why is this an error. Dmd wants to make sure that I declare a new variable > in the foreach statement and not use an existing one? > > module test; > > void main() > { >int i; >int[] nums; >foreach(i; nums) >{ >

Re: Foreach problem

2009-01-10 Thread Bill Baxter
On Sun, Jan 11, 2009 at 12:04 PM, Tim M wrote: > On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: >> Why does it still work for some objects? > > > This works: > > > module test; > > class A > { >this() >{ >// >} > } > > class B > { >this() >

Re: Foreach problem

2009-01-10 Thread Tim M
On Sun, 11 Jan 2009 16:10:39 +1300, Bill Baxter wrote: On Sun, Jan 11, 2009 at 12:04 PM, Tim M wrote: On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: Why does it still work for some objects? This works: module test; class A { this() { // } } class

Re: Foreach problem

2009-01-10 Thread Bill Baxter
On Sun, Jan 11, 2009 at 12:15 PM, Tim M wrote: > On Sun, 11 Jan 2009 16:10:39 +1300, Bill Baxter wrote: > >> On Sun, Jan 11, 2009 at 12:04 PM, Tim M wrote: >>> >>> On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: Why does it still work for some objects? >>> >>> >>> This works: >>> >>>

Re: Foreach problem

2009-01-10 Thread Denis Koroskin
On Sun, 11 Jan 2009 06:04:01 +0300, Tim M wrote: On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: On Sun, 11 Jan 2009 15:50:54 +1300, Daniel Keep wrote: Tim M wrote: Why is this an error. Dmd wants to make sure that I declare a new variable in the foreach statement and not use an e

Re: Foreach problem

2009-01-10 Thread Tim M
On Sun, 11 Jan 2009 19:56:55 +1300, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 11 Jan 2009 06:04:01 +0300, Tim M wrote: On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: On Sun, 11 Jan 2009 15:50:54 +1300, Daniel Keep wrote: Tim M wrote: Why is this an error. Dmd wants to m

Re: Foreach problem

2009-01-10 Thread Denis Koroskin
On Sun, 11 Jan 2009 10:08:47 +0300, Tim M wrote: On Sun, 11 Jan 2009 19:56:55 +1300, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 11 Jan 2009 06:04:01 +0300, Tim M wrote: On Sun, 11 Jan 2009 15:59:26 +1300, Tim M wrote: On Sun, 11 Jan 2009 15:50:54 +1300, Daniel Keep wrote: