Aliases to mutable thread-local data not allowed

mark mark at qtrac.eu
Tue Mar 10 19:12:48 UTC 2020


On Tuesday, 10 March 2020 at 15:27:04 UTC, Steven Schveighoffer 
wrote:
> On 3/10/20 7:09 AM, mark wrote:
[snip]
> Still, the correct thing here is to handle immutable(Deb). 
> However, I'd strongly caution you against casting away 
> immutable, that can lead to undefined behavior in D. Better to 
> just store it as immutable to begin with.

I'm happy to store immutable Debs in
Deb[string] debForName;
but the syntax
immutable(Deb)[string] debForName;
just produced errors.

[snip]
> Hard to see what the problem is here, it looks like you have a 
> function that has unreachable statements, which is why the 
> spawn isn't compiling (the function you are passing it can't 
> compile).

They are only unreachable (I think) because of the stuff further 
down the backtrace.

[snip]
> This looks like an error in std.concurrency (or std.variant), 
> and I'm not sure what is the problem here. It seems std.variant 
> cannot accept an immutable, which makes no sense as immutable 
> data is a huge usecase of std.concurrency.
>
> Can you narrow this down to a small example that can be 
> submitted as a bug report?

I'll try to put the project on github -- if I ever get it working 
it'll be GPL, just that I don't like putting up pre-alpha stuff. 
So then I'll add the link.

Thanks.



More information about the Digitalmars-d-learn mailing list