Re: Multithreaded file IO?

2011-09-25 Thread Jerry Quinn
Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and synchronized (either on the class or a synchronized block around

Re: Multithreaded file IO?

2011-09-25 Thread Jerry Quinn
Lutger Blijdestijn Wrote: If you didn't know, the concurrency chapter of tdpl is a free chapter: http://www.informit.com/articles/article.aspx?p=1609144 It has an example of file copying with message passing: http://www.informit.com/articles/article.aspx?p=1609144seqNum=7 What I really

Re: Multithreaded file IO?

2011-09-25 Thread Jonathan M Davis
On Sunday, September 25, 2011 02:26:18 Jerry Quinn wrote: Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and

Re: Cannot have properties on const references?

2011-09-25 Thread Tobias Pankrath
Property functions are still functions. A member function must be const for it to be callable on a const object. Since we have transitive const, why can't the compiler deduce which methods can be called on const instances?

Re: amd64 install dmd2.055

2011-09-25 Thread Jacob Carlborg
On 2011-09-25 00:56, dsmith wrote: Has anyone here succeeded with a dmd2.055 one-click install to Linux amd64? Unlike the prior dmd2.0xx, I have no luck with dmd2.055 for amd64 installs. I've tried Debian, Fedora, and Suse. After some command line work (based on

Re: Multithreaded file IO?

2011-09-25 Thread Lutger Blijdestijn
Jerry Quinn wrote: Jonathan M Davis Wrote: On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote: Jonathan M Davis Wrote: On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote: A direct rewrite would involve using shared and synchronized (either on the class or a

Re: Any way to expand a tuple?

2011-09-25 Thread Lutger Blijdestijn
Andrej Mitrovic wrote: import std.typetuple; import std.typecons; struct Foo { void test(int x, double y) { } void opOpAssign(string op, T...)(T t) if (op == ~) { test(t); } } void main() { Foo foo; foo.opOpAssign!~(4, 5.0); // ok

Policy-oriented programming.

2011-09-25 Thread Gor F. Gyolchanyan
Hi, D.learn! I encountered a problem, while i was designing a fast, performance-critical image storage mechanism. Here's what i want to do: Have a FragmentTraits struct, which contains fields, like number of components, size in bytes of the components, padding of the components in bytes, etc.

Re: amd64 install dmd2.055

2011-09-25 Thread Gerrit Wichert
I have installed dmd 2.055 on my 64 bit openSuse box. It first asked for affirmation of the adobe reader Eula and then silently failed to install the new dmd version. I tried three times with all the same outcome. Then i removed the old dmd installation and the next install try succeeded. Am

Re: Policy-oriented programming.

2011-09-25 Thread Philippe Sigaud
On Sun, Sep 25, 2011 at 16:49, Gor F. Gyolchanyan gor.f.gyolchan...@gmail.com wrote: Have a FragmentTraits struct, which contains fields, like number of components, size in bytes of the components, padding of the components in bytes, etc. Have a Fragment struct, which takes a FragmentTraits

confusion about structs

2011-09-25 Thread Christian Köstlin
I have this small program, which does some data handling with structs: struct App { private int[] fData; this(size_t initialSize) { fData = new int[initialSize]; } void put(int i) { fData[0] = i; } int[] get() { return fData; } } struct Builder { int i; App app =

Re: confusion about structs

2011-09-25 Thread Andrej Mitrovic
This should make things clearer for you: unittest { auto h1 = get(1); auto h2 = get(2); assert(h1 is h2); // both reference the same array } Field initialization is only done once (once per thread, or if a field is shared once on app start) and not each time you call the

Re: confusion about structs

2011-09-25 Thread Jonathan M Davis
On Sunday, September 25, 2011 23:40:36 Christian Köstlin wrote: I have this small program, which does some data handling with structs: struct App { private int[] fData; this(size_t initialSize) { fData = new int[initialSize]; } void put(int i) { fData[0] = i; }

Re: confusion about structs

2011-09-25 Thread Jonathan M Davis
On Monday, September 26, 2011 00:04:48 Andrej Mitrovic wrote: This should make things clearer for you: unittest { auto h1 = get(1); auto h2 = get(2); assert(h1 is h2); // both reference the same array } Field initialization is only done once (once per thread, or if a

How to return the current object

2011-09-25 Thread alex
Is there a way to return the current object in any part of the code, even from void main? (which is still a type void). I have tried the this thing but it doesn't work -- Alex Herrmann PC load letter

Re: How to return the current object

2011-09-25 Thread Ali Çehreli
On Sun, 25 Sep 2011 20:20:59 -0600, alex wrote: Is there a way to return the current object in any part of the code, I presume you mean returning self from a member function: class C { C foo() { return this; } C bar() { return this; } } void main() {

zlib

2011-09-25 Thread alex
I cannot find a good example on std.zlib, more importantly, the whole void[] and then const void[] stuff really throws me, and I get strange things like out of memory errors upon execution. -- Alex Herrmann PC load letter

Re: zlib

2011-09-25 Thread Vladimir Panteleev
On Mon, 26 Sep 2011 06:04:20 +0300, alex a...@nospam.com wrote: I get strange things like out of memory errors upon execution. That's most likely due to std.zlib allocating in its destructor[1]. I'd think such cases should be quite rare - IIRC it should only happen when a Zlib stream is

Why is std.string.format a c-style variadic function?

2011-09-25 Thread Andrej Mitrovic
I'm only asking because I can't use it inside of a pragma(msg) call since CTFE can't do C-style variadic functions yet. Is `format` defined this way for performance reasons? (to avoid template bloat?)

Re: Why is std.string.format a c-style variadic function?

2011-09-25 Thread Jonathan M Davis
On Monday, September 26, 2011 05:39:16 Andrej Mitrovic wrote: I'm only asking because I can't use it inside of a pragma(msg) call since CTFE can't do C-style variadic functions yet. Is `format` defined this way for performance reasons? (to avoid template bloat?) Use std.metastrings.Format. As