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 > 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 o

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

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(){ size_t[char

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 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 cod

Re: import from subdir

2010-12-23 Thread spir
On Thu, 23 Dec 2010 12:54:42 -0800 Jonathan M Davis 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 it to that code

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

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 por

Re: DMD2 out parameters

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

Re: [D1] type of type

2010-12-23 Thread %u
== Quote from Denis Koroskin (2kor...@gmail.com)'s article > On Fri, 24 Dec 2010 01:28:49 +0300, %u wrote: > > Should have been this: > > > > void func(type t){ > > new t(); > > } > > > > > Try this (not tested): > class Test {} > Object o = Object.factory("Test"); Thanks, Hiding in Object.. in

Re: [D1] type of type

2010-12-23 Thread Denis Koroskin
On Fri, 24 Dec 2010 01:28:49 +0300, %u wrote: Should have been this: void func(type t){ new t(); } Try this (not tested): class Test {} Object o = Object.factory("Test");

Re: [D1] type of type

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

[D1] type of type

2010-12-23 Thread %u
Is it possible to give a function a class(type) as an argument such that the function can call its constructor, without using templates. void func(T t){ new T(); } Or, what is the type of a type? :)

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

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

2010-12-23 Thread Andrej Mitrovic
On 12/23/10, Andrej Mitrovic wrote: > > I'll add this to prowiki. Done: http://prowiki.org/wiki4d/wiki.cgi?EditorSupport/VimEditor And it appears I was wrong because I can actually list template functions, I just didn't use a format specifier before.

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 fun

Re: import from subdir

2010-12-23 Thread Jonathan M Davis
On Thursday 23 December 2010 05:59:37 spir wrote: > On Thu, 23 Dec 2010 05:26:57 -0800 > > Jonathan M Davis 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 > > >

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 members;M:module;

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

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 me

Re: Memory allocation faile on string concat

2010-12-23 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 07:42:36 -0500, Steven Schveighoffer wrote: On Wed, 10 Nov 2010 23:33:58 -0500, Xie 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 - it's truth but not at all. Sorry, but

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

2010-12-23 Thread Steven Schveighoffer
On Thu, 23 Dec 2010 14:51:02 -0500, spir wrote: On Thu, 23 Dec 2010 13:38:30 -0500 "Steven Schveighoffer" wrote: I think it's intentional, and I agree that I've never used or thought "gee, I wish D did this". I wouldn't be sorry to see it go. In fact, I'd advocate for getting rid of it.

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

2010-12-23 Thread spir
On Thu, 23 Dec 2010 13:38:30 -0500 "Steven Schveighoffer" wrote: > I think it's intentional, and I agree that I've never used or thought > "gee, I wish D did this". I wouldn't be sorry to see it go. In fact, I'd > advocate for getting rid of it. It creates a hidden allocation, which I'm

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

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; Discl

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 look

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

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 ei

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

2010-12-23 Thread Steven Schveighoffer
On Thu, 23 Dec 2010 12:34:45 -0500, Don 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 languages of the

Re: Strange socket error

2010-12-23 Thread Bob Cowdery
Hi All communication is appreciated. I often find just trying to explain a problem can lead to fixing it. Sorry this is a bit rambling. I know D is not done yet and there will be bugs. I don't know yet if its me or D. The program structure is quite simple. 1. I have 3 pieces of C code. An interfa

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 are

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 never

Re: DMD2 out parameters

2010-12-23 Thread Pete
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 anyone confirm

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

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

2010-12-23 Thread Andrej Mitrovic
On 12/23/10, 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

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

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 disa

Re: import from subdir

2010-12-23 Thread spir
On Thu, 23 Dec 2010 05:26:57 -0800 Jonathan M Davis 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] > >

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 a

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 -

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: 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 o

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

2010-12-23 Thread spir
On Thu, 23 Dec 2010 00:34:41 -0600 Christopher Nicholson-Sauls 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. For examp

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

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++; } ])