November 11, 2013
On Tuesday, November 12, 2013 00:37:30 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.

I believe that in the past, Variant hasn't worked with immutable, so if it doesn't work with it now, then presumably, that was never fixed.

- Jonathan M Davis
November 12, 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));
November 12, 2013
On 12/11/13 00:31, Dicebot wrote:
> On Monday, 11 November 2013 at 23:21:14 UTC, Joseph Rushton Wakeling wrote:
>> (the message for which won't be printed if it's thrown in the thread).
>
> Whoa, didn't know that, I thought it will terminate the thread and cause related
> exception in owner thread. I have just checked it an yeah, assertion error is
> thrown:

Yea, it's unintuitive -- I got bitten by it earlier in the year:
http://forum.dlang.org/thread/51D16259.1010009@webdrake.net
1 2
Next ›   Last »