www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Revamped concurrency API

reply bearophile <bearophileHUGS lycos.com> writes:
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. 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. 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. Bye, bearophile
Oct 12 2009
next sibling parent reply Jeremie Pelletier <jeremiep gmail.com> writes:
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. 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

Oct 12 2009
next sibling parent Don <nospam nospam.com> writes:
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


Oct 13 2009
prev sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Tue, 13 Oct 2009 10:10:31 +0400, Jeremie Pelletier <jeremiep gmail.co=
m>  =

wrote:

 I never liked the Object vs Object? syntax, that would just create  =

 ambiguity with the ternary conditional. D already dropped the template=

 syntax from C++ to drop the ambiguity with <> and comparison operators=


=D0=A1# uses this syntax, and there is no ambiguity.
Oct 13 2009
prev sibling parent Bartosz Milewski <bartosz-nospam relisoft.com> writes:
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. 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. 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.

This is where Java shines. Their annotation system is flexible enough to allow this kind of experimenting. In particular they were able to implement const and nonNull using annotations. See the talk by Mike Ernst from the University of Washington: http://www.vimeo.com/4368251 .
Oct 15 2009