Am 07.02.2014 02:45, schrieb Sean Kelly:
What's an Isolated!T? Is that for ownership transfer?
Exactly, that and also as a possible way to build up immutable
structures. It basically guarantees recursively that there is no mutable
aliasing with the outside world going on and comes in two forms:
- "strongly isolated": Allows only types that contain either POD,
other isolated references, or immutable references. This can be
implicitly converted/moved toimmutable
and can be safely transferred
between threads withoutshared
or locking. - "weakly isolated": Also allows
shared
references. This cannot be
converted toimmutable
, but can still be moved safely between threads.
Together with support for array splitting and fusion, this provides a
nice safe and efficient way for multi-threaded array operations.
This started as a little proof of concept for a possible D type modifier
to see how practical it is to work with and if a sound definition is
possible. Looks quite promising, except that it often scratched DMD's
limits w.r.t. templates and CTFE (in terms of compiler bugs), which is
why a few safety measures are still disabled.