Re: Passing associative array to another thread

2012-09-25 Thread Jacob Carlborg
On 2012-09-25 00:47, Sean Kelly wrote: If you're passing via std.concurrency then you'll currently have to cast to shared. I'd been considering allowing Unique!T to be sent as well, but haven't done so yet. Hey, if it's immutable why use std.concurrency at all? Just import the module and

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Dmitry Olshansky
On 25-Sep-12 00:10, TJB wrote: Hello, I am trying to save some data to compressed binary files. I have my data in a struct, which I can write to a binary file just fine: align(1) struct TradesBin { Just a note: recently compiler changed so this align(1) have no effect on the fields

Re: Testing for template argument being result of takeExactly

2012-09-25 Thread monarch_dodra
On Monday, 24 September 2012 at 22:13:51 UTC, Timon Gehr wrote: On 09/24/2012 09:41 AM, monarch_dodra wrote: [SNIP] I don't think this does what you think it does. The 'is(R r)' declares r to be an alias for R. So 'r' is a type in that code snippet. Darn :( Also, is(typeof(takeExactly(R,

Re: Zipped sorting

2012-09-25 Thread Dmitry Olshansky
On 25-Sep-12 06:18, bearophile wrote: This line of code sorts two arrays in lock step, according to the items of the first array: zip(first, second).sort!q{a[0] b[0]}(); This code is handy, nice looking, short and sufficiently easy to recognize once you have seen it before. Analyzing asm

Re: FormattedRead hex string

2012-09-25 Thread monarch_dodra
On Monday, 24 September 2012 at 22:38:59 UTC, Jason Spencer wrote: On Monday, 24 September 2012 at 16:32:45 UTC, monarch_dodra wrote: On Monday, 24 September 2012 at 15:05:54 UTC, Jason Spencer wrote: I imagine there's a slick way to do this, but I'm not seeing it. I have a string of hex

Re: Zipped sorting

2012-09-25 Thread bearophile
Dmitry Olshansky: Analyzing asm dump should help. In this case it's a good amount of asm code. But either way zip-sort heavily relies on proper inlining and I suspect it's not fully unrolled. I don't know if that's enough. Did you try DMD or other compilers? In past I have used LDC

How can I hide implementation details when make a library

2012-09-25 Thread Daniel Kozak
Hello, I try to make for example some small library called libX. In C/C++ I can make libX.h(pp) and libX.c(xx), where libX.h will contain only interface for implementation from libX.c. How can I achive this in D2? When I trak dmd -o- -op -H libX.d it will generate libX.di, but this file

Re: How can I hide implementation details when make a library

2012-09-25 Thread Jacob Carlborg
On 2012-09-25 13:39, Daniel Kozak wrote: Hello, I try to make for example some small library called libX. In C/C++ I can make libX.h(pp) and libX.c(xx), where libX.h will contain only interface for implementation from libX.c. How can I achive this in D2? When I trak dmd -o- -op -H libX.d it

Re: How can I hide implementation details when make a library

2012-09-25 Thread Daniel Kozak
Yes, it works. Thanks a lot. However I still dont get it, why dmd generates all sources instead of just public symbols and functions declarations On Tuesday, 25 September 2012 at 11:39:56 UTC, Jacob Carlborg wrote: On 2012-09-25 13:39, Daniel Kozak wrote: Hello, I try to make for

Re: How can I hide implementation details when make a library

2012-09-25 Thread Jacob Carlborg
On 2012-09-25 13:58, Daniel Kozak wrote: Yes, it works. Thanks a lot. However I still dont get it, why dmd generates all sources instead of just public symbols and functions declarations The source code is included to be able to inline the functions. It's probably has something to do with

Re: Passing associative array to another thread

2012-09-25 Thread Jacob Carlborg
On 2012-09-21 16:33, Martin Drasar wrote: Hi, I am using the std.concurrency module and I would like to send an associative array to another thread. If I try this: string[string] aa; someThread.send(aa); I get: Aliases to mutable thread-local data not allowed. And if I try to use this:

Re: Passing associative array to another thread

2012-09-25 Thread Martin DraĊĦar
Dne 25.9.2012 18:19, Jacob Carlborg napsal(a): BTW, why do you need to use std.currency at all if it's immutable, just share it as a global. The whole point of immutable is that it can be freely shared among threads without any risks. It is not some single piece of data. I have a queue of

Re: How can I hide implementation details when make a library

2012-09-25 Thread Jonathan M Davis
On Tuesday, September 25, 2012 13:58:00 Daniel Kozak wrote: Yes, it works. Thanks a lot. However I still dont get it, why dmd generates all sources instead of just public symbols and functions declarations A number of features do not work if not all of the source is available. In

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Justin Whear
On Tue, 25 Sep 2012 03:25:37 +0200, TJB wrote: Since you're already set up with the Stream interface, try creating a MemoryStream instead of a BufferedFile. Write to the stream just as you are now, then use the .data() property (on MemoryStream's superclass, TArrayStream) to get an array of

Re: Zipped sorting

2012-09-25 Thread Dmitry Olshansky
On 25-Sep-12 15:23, bearophile wrote: Dmitry Olshansky: Analyzing asm dump should help. In this case it's a good amount of asm code. This sounds like you are not interested in the cause of this at all ;) I've dig it and it looks mostly fine. However for a small number of elements it

Runtime termination hook?

2012-09-25 Thread Jacob Carlborg
Is there an event that I can hook into which is called when the runtime is terminated? -- /Jacob Carlborg

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
On Tuesday, 25 September 2012 at 18:08:44 UTC, Justin Whear wrote: I wrote up a quick example program and pasted it here: http://dpaste.dzfl.pl/f1699d07 Hope that helps you out. Justin, Thanks so much! Very helpful!!! TJB

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Justin Whear
On Tue, 25 Sep 2012 18:08:44 +, Justin Whear wrote: On Tue, 25 Sep 2012 03:25:37 +0200, TJB wrote: Since you're already set up with the Stream interface, try creating a MemoryStream instead of a BufferedFile. Write to the stream just as you are now, then use the .data() property (on

GUI development libraries in D?

2012-09-25 Thread Matthew Turner
Hello, I'm wondering if there is any library for making a GUI with D. If not, what would you recommend for that? Could I just use c++ libraries? Thank you, Matt

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
On Tuesday, 25 September 2012 at 18:08:44 UTC, Justin Whear wrote: I wrote up a quick example program and pasted it here: http://dpaste.dzfl.pl/f1699d07 Hope that helps you out. OK, I think I am working this out. Let's say I want to write the data to a gzipped file that will be

Re: GUI development libraries in D?

2012-09-25 Thread Jordi Sayol
Al 25/09/12 23:52, En/na Matthew Turner ha escrit: Hello, I'm wondering if there is any library for making a GUI with D. If not, what would you recommend for that? Could I just use c++ libraries? https://github.com/gtkd-developers/GtkD -- Jordi Sayol