reddit discussion about Go turns to D again

Jonathan M Davis jmdavisProg at gmx.com
Sun May 15 19:17:13 PDT 2011


On 2011-05-15 17:20, Andrei Alexandrescu wrote:
> On 05/15/2011 07:11 PM, dsimcha wrote:
> > On 5/15/2011 8:06 PM, Andrei Alexandrescu wrote:
> >> The function signatures would be identical underlying the fact that
> >> their actual semantics are identical.
> >> 
> >> Andrei
> > 
> > Not so sure. For parallel computation, you'd probably want to have some
> > additional, though optional, configurability for things like work unit
> > size.
> 
> Sure. Those are not per call call though. std.algorithm offers a ton of
> functions. The cleanest way to expose parallel equivalents is as
> functions with identical signatures in a different module. It's very
> much in the spirit of D.
> 
> We should take a look at Gnu parallel.
> http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html, which
> does the same (and I think they made the right decision).

The problem is that then you have name-clashes galor. If you ever import 
std.algorithm and std.parallel_algorithm in the same module (which is very 
likely to happen, I expect), then you're either going to have to use aliases 
all over the place, or give the whole module name for std.algorithm and 
std.parallel_algorithm with most function calls. That would _not_ be pleasant. 
Now, it may be worth that pain simply because then it's incredibly obvious 
that the parallel versions are the same (except parallel) and because it means 
that you could possibly just swap out std.algorithm for std.parallel_algorithm 
in some cases, but I think that we should seriously consider whether we want a 
whole module's worth of name clashes.

- Jonathan M Davis


More information about the Digitalmars-d mailing list