An important pull request: accessing shared affix for immutable data

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 24 04:19:43 PDT 2016


Am Sat, 13 Feb 2016 19:16:43 +0100
schrieb Timon Gehr <timon.gehr at gmx.ch>:

> Not necessarily. shared is transitive and prefix/suffix are arbitrary 
> types which might contain mutable indirections.

I don't want to disturb your conversation, but how about
designing a working "shared" first? My last attempt at
using it on aggregate fields was frustrating and asked for a
complete redesign, similar to "inout".

Some of my most frustrating moments, some of which I discussed
with Sean Kelly who had a better understanding of the runtime:

Ramblings on the FAQ on shared:
http://www.digitalmars.com/d/archives/digitalmars/D/D_2.0_FAQ_on_shared_246071.html

None of core.sync is shared:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/m_condition.mutex_cannot_be_used_in_shared_method_64874.html

When casting away shared I needed a way to pass a "depth"
to the case, resulting in this template by John Colvin (where
depth is reduced to 1 level or all, but you get the idea):
http://www.digitalmars.com/d/archives/digitalmars/D/learn/How_do_you_get_T_from_shared_T_64230.html

Cannot destroy a shared struct:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/How_to_destroy_a_shared_struct._55603.html

Here I tried to do away with the explicit casts by listing the
variables that are protected under a specific mutex:
http://www.digitalmars.com/d/archives/digitalmars/D/New_scope_modifier_unshared_for_temporary_ownership_of_shared_228907.html

--
Marco



More information about the Digitalmars-d mailing list