std.concurrency : sending immutable classes
Dejan Lekic
dejan.lekic at gmail.com
Mon Nov 11 16:00:46 PST 2013
On Tue, 12 Nov 2013 00:37:30 +0100, Dicebot wrote:
> Minimized repro:
>
> import std.variant;
>
> class A {}
>
> void main()
> {
> Variant v = new immutable A();
> auto x = v.get!(immutable A)(); // triggers assert
> }
>
> One simple question - did this ever work? :) Because passing immutable
> aggregate messages is sometimes sold as one of "proper"
> usage scenario of std.concurrency and if it was never actually
> implemented, that is damn sad. I have started to investigate this
> scenario because of question on topic in #d @ freenode.
Looks like Variant works only with implicitly convertible types.
In this case this fails:
assert(isImplicitlyConvertible!(immutable(A), A));
More information about the Digitalmars-d-learn
mailing list