Array of closures assign

2010-12-23 Thread bearophile
This D2 program compiles with no errors: void delegate()[1] foo; void main() { int n; foo[0] = { n++; }; } But this one: void delegate()[1] foo; void main() { int n; foo[] = [{ n++; }]; } test.d(4): Error: cannot implicitly convert expression ([delegate void() { n++; }

Re: Strange socket error

2010-12-23 Thread Bob Cowdery
Hi Heywood Thankyou for your time. Yes I agree making the call blocking does stop the exceptions churning. Unfortunately the application stops accepting data now because after the first incoming transfer from the web socket client it sees data on the listening socket and promptly blocks on it and

Re: double - double[]... | feature or bug?

2010-12-23 Thread spir
On Thu, 23 Dec 2010 00:34:41 -0600 Christopher Nicholson-Sauls ibisbase...@gmail.com wrote: On 12/22/10 15:06, Andrej Mitrovic wrote: Oooh. That cought me off guard, sorry. Thanks Steve. I'll concede that the syntax can be odd at first, but it also enables some interesting things.

Re: double - double[]... | feature or bug?

2010-12-23 Thread bearophile
spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family. The main problem here is that I have never felt the need of

import from subdir

2010-12-23 Thread spir
Hello, Say I have a project with the following tree structure: [app] app.d util.d [test] test.d [data] data.d Is there a way to import util data from test? Denis -- -- -- -- -- -- -- vit esse estrany ☣ spir.wikidot.com

Re: import from subdir

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 04:38:56 spir wrote: Hello, Say I have a project with the following tree structure: [app] app.d util.d [test] test.d [data] data.d Is there a way to import util data from test? Use the -I flag when

Re: is this the expected output

2010-12-23 Thread Dmitry Olshansky
On 23.12.2010 3:40, g g wrote: Thanks for the answers what I did is this ( i feel that it is quite clumsy): Node* x = cast(Node*) (GC.malloc(Node.sizeof)); *x = xa; x.up = curnode; ... which could be improved: Node* x = new Node(...);//paste your constructor

Re: import from subdir

2010-12-23 Thread spir
On Thu, 23 Dec 2010 05:26:57 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: On Thursday 23 December 2010 04:38:56 spir wrote: Hello, Say I have a project with the following tree structure: [app] app.d util.d [test] test.d [data]

DMD2 out parameters

2010-12-23 Thread Pete
Hi, I'm not sure if this is already a widely known phenomenon but I ran across a little gotcha yesterday regarding floating point out parameters using DMD2. A year or so ago I wrote a ray tracer using DMD1. A few months ago I tried compiling and running it using DMD2. It was 50% slower. This

Re: DMD2 out parameters

2010-12-23 Thread Pete
//If you initialise f to 0 before calling func then it all works quickly again Actually I think this is a red herring. I don't think initialising f helps

Re: double - double[]... | feature or bug?

2010-12-23 Thread Andrej Mitrovic
On 12/23/10, bearophile bearophileh...@lycos.com wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family. The

Re: Strange socket error

2010-12-23 Thread Heywood Floyd
Hi! I see. I think my previous answer was a bit naive—I didn't appreciate the full scope of the problem. Sorry for that, but you know, internet is fast, snap snap : ) Ok, for now I'm afraid I don't have any more to add. (An isolated example would of course help greatly!) All I can say is,

Re: double - double[]... | feature or bug?

2010-12-23 Thread Don
bearophile wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other languages of the family. The main problem here is that I have

Do we already have full compile time / runtime separation?

2010-12-23 Thread Mariusz Gliwiński
Hello, I've been trying to manage this on my own for like 2 days but still couldn't do that, and because my brain just suddenly turned-off, I would ask You for some guidance. The thing is: I'd like to make some kind of messaging in my application. So, there is - interface Msg - classes that

Re: double - double[]... | feature or bug?

2010-12-23 Thread Steven Schveighoffer
On Thu, 23 Dec 2010 12:34:45 -0500, Don nos...@nospam.com wrote: bearophile wrote: spir: While I understand some may consider this a nice feature, for me this is an enormous bug. A great way toward code obfuscation. I like D among other reasons because it's rather clear compared to other

Vim: Anyone using taglist.vim with D?

2010-12-23 Thread Andrej Mitrovic
I know there's a few people here that use Vim, so has anyone succesfully used the taglist.vim plugin with D? Ctags work for me (on XP), but I can't get taglist to work with D. It does work with C/CPP files, but it seems to ignore D files. I'm asking before I try to modify the plugin, because

Re: DMD2 out parameters

2010-12-23 Thread Don
Pete wrote: Ok, i've done some more investigating and it appears that in DMD2 a float NaN is 0x7FE0 (in dword format) but when it initialises a float 'out' parameter it initialises it with 0x7FA0H. This causes an FPU trap which is where the time is going. This looks like a bug to me. Can

Re: DMD2 out parameters

2010-12-23 Thread Johann MacDonagh
On 12/23/2010 12:19 PM, Pete wrote: Ok, i've done some more investigating and it appears that in DMD2 a float NaN is 0x7FE0 (in dword format) but when it initialises a float 'out' parameter it initialises it with 0x7FA0H. This causes an FPU trap which is where the time is going. This

Re: import from subdir

2010-12-23 Thread CrypticMetaphor
On 12/23/2010 1:38 PM, spir wrote: Is there a way to import util data from test? I think this should work: util.d first line: module util; data.d first line module data.data; test.d first lines module test.test; import util; import data.data;

Re: Undefined references when linking to C library

2010-12-23 Thread Peter Federighi
Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the functions. In fact, a large portion of - in not all of - your gpm.d

Re: Memory allocation faile on string concat

2010-12-23 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 07:42:36 -0500, Steven Schveighoffer schvei...@yahoo.com wrote: On Wed, 10 Nov 2010 23:33:58 -0500, Xie xiema...@gmail.com wrote: OK, this actually makes sense to me. It's a manifestation of this issue: http://d.puremagic.com/issues/show_bug.cgi?id=3929 I'm think -

Re: Do we already have full compile time / runtime separation?

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 01:11:40 Mariusz Gliwiński wrote: Hello, I've been trying to manage this on my own for like 2 days but still couldn't do that, and because my brain just suddenly turned-off, I would ask You for some guidance. The thing is: I'd like to make some kind of

Re: import from subdir

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 11:30:40 CrypticMetaphor wrote: On 12/23/2010 1:38 PM, spir wrote: Is there a way to import util data from test? I think this should work: util.d first line: module util; data.d first line module data.data; test.d first lines module

Re: Vim: Anyone using taglist.vim with D?

2010-12-23 Thread Andrej Mitrovic
Got it working! I just needed to create an extra variable for taglists. I'm using this: let tlist_d_settings='d;c:classes;d:macro definitions;e:enumerators (values inside an enumeration);f:function definitions;g:enumeration names;l:local variables [off];m:class, struct, and union

Re: Undefined references when linking to C library

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 11:38:28 Peter Federighi wrote: Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the

Re: Undefined references when linking to C library

2010-12-23 Thread Jérôme M. Berger
Peter Federighi wrote: Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the functions. In fact, a large portion of - in

Re: [D1] type of type

2010-12-23 Thread %u
Should have been this: void func(type t){ new t(); }

Re: DMD2 out parameters

2010-12-23 Thread Pete
I noticed this on an Intel Core 2. I skipped the pentium 4 generation :)

Re: Undefined references when linking to C library

2010-12-23 Thread wrzosk
On 23.12.2010 20:38, Peter Federighi wrote: Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the functions. In fact, a large

Re: Undefined references when linking to C library

2010-12-23 Thread Peter Federighi
wrzosk wrote: I've had simmilar issue a few days ago. The problem is that global values from C should be marked shared in D extern int val; - extern (C) shared int val; or maybe __gshared. Both makes linking stage finishes with success. Jerome M. Berger wrote: I think gpm_zerobased,

Re: import from subdir

2010-12-23 Thread spir
On Thu, 23 Dec 2010 12:54:42 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: What you're trying to do is pretty abnormal really, as far as your average module goes. I assume that you're writing a test app which needs access to the main body of code and are trying to find a way to point

Re: import from subdir

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 16:42:15 spir wrote: On Thu, 23 Dec 2010 12:54:42 -0800 Jonathan M Davis jmdavisp...@gmx.com wrote: What you're trying to do is pretty abnormal really, as far as your average module goes. I assume that you're writing a test app which needs access to the main

TDPL dictionary example - error

2010-12-23 Thread Caligo
Greetings, I just joined here, so sorry if this has been posted before. I'm reading TDPL and the example on page 8 doesn't compile. I'm using the latest GDC with GCC 4.4.5. I've checked the errata, but nothing for this error. import std.stdio; import std.string; void main(){

Re: TDPL dictionary example - error

2010-12-23 Thread Mariusz Gliwiński
Friday 24 December 2010 @ 06:24:34 Caligo: Greetings, I just joined here, so sorry if this has been posted before. I'm reading TDPL and the example on page 8 doesn't compile. I'm using the latest GDC with GCC 4.4.5. I've checked the errata, but nothing for this error. import

Re: TDPL dictionary example - error

2010-12-23 Thread Caligo
No, GDC supports D1 and D2. Version 2.051 I think. I know I've compiled mine with D2 support. 2010/12/24 Mariusz Gliwiński alienballa...@gmail.com Friday 24 December 2010 @ 06:24:34 Caligo: Greetings, I just joined here, so sorry if this has been posted before. I'm reading TDPL and