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 this I need to copy the data to an immutable transfer buffer to use in the send. I'm sure this is simple but I can't figure it. 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 float[] to immutable (float)[]' If I try a float by float copy into xfer it can't because I've said the buffer is immutable. In the first example I can't figure out how to convert the slice into an immutable copy which I think is what I should be doing. Can someone point me in the right direction. Thanks Bob