On 10/10/13 12:18 AM, Walter Bright wrote:
On 10/9/2013 11:34 PM, Jacob Carlborg wrote:
On 2013-10-10 02:22, Sean Kelly wrote:

Only that this would have to be communicated to the user, since
moving data
later is problematic. Today, I think it's common to construct an
object as
unshared and then cast it.

What is the reason to not create it as "shared" in the first place?

1. Shared data cannot be passed to regular functions.

I don't understand this. If a function/method accepts "shared", then it can be passed shared data.

2. Functions that create data structures would have to know in advance
that they'll be creating a shared object. I'm not so sure this would not
be an invasive change.

There is no other way around it. And this is not a change - it's fixing something.

3. Immutable data is implicitly shared. But it is not created immutable
- it is created as mutable data, then set to some state, then cast to
immutable.

That all must happen in the runtime, NOT in user code.


Andrei

Reply via email to