[dmd-concurrency] Smoke test

Michel Fortin michel.fortin at michelf.com
Fri Jan 8 17:11:20 PST 2010


Le 2010-01-08 à 15:04, Walter Bright a écrit :

> Steve Schveighoffer wrote:
>> The only caveat is, we would *need* to change the semantics of shared so that you can have a non-shared reference to a shared class instance easily.
> 
> That's the so-called "tail-shared" problem. We tried (hard) to make "tail-const" work, where the reference is mutable but the contents were const. It sounds simple, but just does not work in a language with implicit reference semantics.

I wrote something using immutable objects once. I had to use Rebindable (after fixing it) for almost all members of type object. It was quite annoying. I predict the same thing will happen for shared.

I'm don't really want to reopen the const debate, but I feel the same issue is going to repeat itself with shared and it makes me feel uneasy too. Are we going to need Rebindable!(TailShared!(const shared T))? All I can see that could work is some sort of tail modifier, like "const! shared! T" (change "!" for your preferred character). It isn't very intuitive, but neither is Rebindable!(TailShared!(const shared T)) and at least it looks better and should play better with overloading.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list