Manu's `shared` vs the @trusted promise

Atila Neves atila.neves at gmail.com
Mon Oct 22 13:36:43 UTC 2018


On Monday, 22 October 2018 at 09:40:42 UTC, Manu wrote:
> On Mon, Oct 22, 2018 at 2:21 AM ag0aep6g via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>>
>> On 22.10.18 10:39, Simen Kjærås wrote:
>> > On Sunday, 21 October 2018 at 22:03:00 UTC, ag0aep6g wrote:
>> [...]
>> > It's invalid only if Atomic.badboy exists.
>>
>> I don't agree. I prefer the stronger @trusted. As far as I 
>> know, the stronger one is the current one.
>
> The current one has the critical weakness that it causes 
> **EVERY USER** to write unsafe code, manually casting things to 
> shared.

Nope:

-------
auto list = /*new?*/ shared MyFancyLockFreeList();
-------

If you want a `shared` something, create it as shared to begin 
with, there's no need to cast.




More information about the Digitalmars-d mailing list