Re: Immutable woes

2010-09-21 Thread Stanislav Blinov
21.09.2010 11:29, Bob Cowdery wrote: if I say something like: float[] xfer = new float[512]; xfer = buffer[0 .. $/2]; tid.send(xfer); Try this auto xfer = buffer[0..$/2].idup; tid.send(xfer);

Re: Immutable woes

2010-09-21 Thread Simen kjaeraas
Bob Cowdery wrote: Ok, so assumeUnique when I read it a bit more will still share data but idup will copy data. Where are the docs for that. Something else not in the book - but then I guess there is a lot of detail not in the book. Thank goodness for forums. The thing is, slices (as you did

Re: Immutable woes

2010-09-21 Thread Bob Cowdery
Ok, so assumeUnique when I read it a bit more will still share data but idup will copy data. Where are the docs for that. Something else not in the book - but then I guess there is a lot of detail not in the book. Thank goodness for forums. bob On 21/09/2010 09:10, Pelle wrote: > On 09/21/2010 0

Re: Immutable woes

2010-09-21 Thread Pelle
On 09/21/2010 09:29 AM, Bob Cowdery wrote: Hi I'm stuggling with immutable. I have a fixed size buffer which is used as a circular buffer of floats and is effectively double buffering data I wish to transfer to another thread. At an appropriate point I take the top half or bottom half of the

Re: Immutable woes

2010-09-21 Thread Simen kjaeraas
Bob Cowdery wrote: Thanks, that at least builds now. I didn't see that trick in the book but I've found it on the on-line library ref under std.exception. I can't say I understand why its under std.exception. I know. It used to be std.contracts, which makes a bit more sense. Then, someone de

Re: Immutable woes

2010-09-21 Thread Bob Cowdery
Thanks, that at least builds now. I didn't see that trick in the book but I've found it on the on-line library ref under std.exception. I can't say I understand why its under std.exception. bob On 21/09/2010 08:48, Simen kjaeraas wrote: > Bob Cowdery wrote: > >> if I say something like: >> flo

Re: Immutable woes

2010-09-21 Thread Simen kjaeraas
Bob Cowdery wrote: if I say something like: float[] xfer = new float[512]; xfer = buffer[0 .. $/2]; tid.send(xfer); it rightly tells me 'thread local data not allowed'. If I make it: immutable (float)[] xfer; xfer = buffer[0 .. $/2]; tid.send(xfer); it tells me 'can't implicitly convert floa

Immutable woes

2010-09-21 Thread Bob Cowdery
Hi I'm stuggling with immutable. I have a fixed size buffer which is used as a circular buffer of floats and is effectively double buffering data I wish to transfer to another thread. At an appropriate point I take the top half or bottom half of the buffer and send it to another thread. To do t