"Almost there" version of TDPL updated on Safari Rough Cuts

dsimcha dsimcha at yahoo.com
Fri Dec 11 08:54:26 PST 2009


== Quote from Sean Kelly (sean at invisibleduck.org)'s article
> Álvaro Castro-Castilla Wrote:
> >
> > Language extensions for message passing, such as Kilim for Java send messages
giving away the ownership of data, not copying it. That's a reason for the need of
compiler/runtime support.
> Knowledge of unique ownership can obviate the need for copying, but copying is a
reasonable fall-back in most cases.
> > Also, parallel map/foreach is more feasible as a library-only solution,
whether the message passing requires some support from the runtime environment.
> It really depends on the language and what your goals are.  There are message
passing libraries for C, for example, but they don't provide much in the way of
safety.

IDK, generally I agree with the idea that D and Phobos should provide safe
defaults and more efficiency when you really need it and explicitly ask for it.
The exception, though, is when someone is using a construct that would only be
used by people who really need efficiency, and thus has already explicitly asked
for efficiency.  This includes parallel foreach.  In these cases, I think that
"efficiency first, safety second" has to be the rule and there should never, ever
be any implicit copying.  If you can't implement this safely, then it should be
implemented unsafely and place the onus of ensuring safety on the programmer.

Concurrency for purposes other than pure throughput performance is a completely
different animal, though one that I admittedly have never needed to deal with.
Here, safety counts much more.



More information about the Digitalmars-d mailing list