11-Oct-2013 05:21, Andrei Alexandrescu пишет:
On 10/10/13 5:36 PM, Jonathan M Davis wrote:
On Thursday, October 10, 2013 10:55:49 Andrei Alexandrescu wrote:
On 10/10/13 12:33 AM, Jonathan M Davis wrote:
I honestly don't think we can solve it a different way without
completely
redesigning shared. shared is specifically designed such that you
have to
either cast it way to do anything with it
no
or write all of your code to
explicitly work with shared, which is not something that generally
makes
sense to do unless you're creating a type whose only value is in being
shared across threads.
yes
Really? Do you honestly expect the average use of shared to involve
creating
structs or classes which are designed specifically to be used as shared?
Yes. Data structures that can be shared are ALWAYS designed specifically
for sharing, unless of course it's a trivial type like int.
This. And exactly the same for immutable. It's interesting how folks
totally expect complex types (like containers) to meaningfully work with
all 3 qualifiers.
Sharing
means careful interlocking and atomic operations and barriers and stuff.
You can't EVER expect to obtain all of that magic by plastering "shared"
on top of your type.
Yup.
Andrei
--
Dmitry Olshansky