Revamped concurrency API

Don nospam at nospam.com
Tue Oct 13 02:44:01 PDT 2009


Jeremie Pelletier wrote:
> bearophile wrote:
>> Jeremie Pelletier:
>>
>>> I vote for a 'lent' qualifier to be implemented in the compiler.
>>
>> You may be right, and Bartosz has explained me why and how to use 
>> lent. It sounds like a nice idea, but it has some costs too (in 
>> language complexity, for example). But I need to use such things in 
>> practice, in real (even small) programs to know/understand if I like 
>> and understand them enough.
> 
> I don't see how heavy that cost is since all of 
> const/immutable/lent/shared are type qualifiers, the semantics are 
> already there for const and immutable, and half there for shared.
> 
> I would also much prefer compiler implementations to be a bit more 
> complex and implement lent/shared properly than push that complexity to 
> user code. If we're trying to get rid of data races and deadlocks and 
> whatnot, the last thing we want are complex implementations in 
> library/user code because they lack the proper language primitives.
> 
> If we have just those two qualifiers, the rest of the concurrent models 
> can be implemented entirely in the library.
> 
>> So I'd like to have an experimental version of D where such ideas 
>> (like lend, nonnull references, and few other things) can be tried, 
>> and if they are experimentally seen as not good (by me too), they can 
>> be discarded and removed. For me this is true for nonnull references, 
>> but such experimental need is even strong for lend.
> 
> D2 is already 'experimental' if you consider the state of shared right 
> now :)
> 
>> It seem all the long discussion regarding nonnull references has gone 
>> nowhere. That has made me a little sad. Only a bit of flow analysis 
>> has being accepted, to cover certain cases of a specific bug case of 
>> uninitialized objects.
> 
> I never liked the Object vs Object? syntax, that would just create 
> ambiguity with the ternary conditional.

We tried really hard to find a situation that was ambiguous, but without 
success. I think it's OK.


  D already dropped the template
> syntax from C++ to drop the ambiguity with <> and comparison operators.
> 
> I wouldn't mind something like nonnull(Object), ie yet another type 
> qualifier, although that would get cumbersome in a few cases like 
> const(shared(nonnull(Object))) :o)
> 
>> Bye,
>> bearophile



More information about the Digitalmars-d mailing list