On Sunday, 10 May 2015 at 10:51:54 UTC, Michel Fortin wrote:
On 2015-05-10 09:50:00 +0000, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
3. Thread-local vs. shared objects
Currently in D it's legal to allocate memory in one thread and
deallocate it in another. (One simple way to look at it is
casting to shared.) This has a large performance cost that
only benefits very few actual cases.
It follows that we need to change the notion that you first
allocate memory and then brand it as shared. The "will be
shared" knowledge must be present during allocation, and use
different methods of allocation for the two cases.
Shared is implicit in the case of immutable. Think carefully:
if you implement this and it has any efficiency benefit for
non-shared allocations, const-allocated objects and arrays will
become more performant than immutable-allocated ones. People
will thus have an incentive to stay away from immutable.
If immutable does not pull its weight in other ways, it's just
not worth it.