Hi

I'm wondering what the state of the language/libraries are with regard to shared/immutable qualifiers. I've tried to use std.concurrency and had a lot of compile issues passing shared data around.
Even a simple case I'm finding issue with:

---------
import std.array;

int main(string[] argv)
{
        shared uint[] arr = stuffone(); 
        return 0;
}

shared uint[] stuffone()
{
        shared uint[] arr = new shared (uint[1]);
        arr[0] = 1;     
        return cast(shared)arr;
}

---------
Compile error:
shared.d(6): Error: cannot implicitly convert expression (stuffone()) of type uint[] to shared(uint[]) shared.d(15): Error: cannot implicitly convert expression (arr) of type shared(uint[]) to uint[]

Another case I couldn't construct an appender to shared data:
---------
import std.array;

int main(string[] argv)
{
Appender!(shared uint[]) app = std.array.appender!(shared uint[]);
        return 0;
}
---------
Compile error:

Error: incompatible types for ((cast(shared(uint)*)arr) is (cast(uint*)(*this._data).arr)): 'shared(uint)*' and 'uint*' shared.d(6): Error: template instance std.array.Appender!(shared(uint[])) error instantiating shared.d(6): Error: constructor std.array.Appender!(shared(uint[])).Appender.this (shared(uint)[] arr) is not callable using argument types (Appender!(shared(uint)[])) shared.d(6): Error: cannot implicitly convert expression (appender(null)) of type Appender!(shared(uint)[]) to shared(uint)[] std\array.d(1878): Error: incompatible types for ((cast(shared(uint)*)arr) is (cast(uint*)(*this._data).arr)): 'shared(uint)*' and 'uint*'


Not sure if I'm missing something obvious.
Thanks.


Reply via email to