reddit discussion about Go turns to D again

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun May 15 19:59:15 PDT 2011


On 05/15/2011 09:17 PM, Jonathan M Davis wrote:
> 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.

import std.algorithm;
static import std.parallel_algorithm;

That uses stuff in std.algorithm by default, and stuff in 
std.parallel_algorithm on demand. Perfect.


Andrei


More information about the Digitalmars-d mailing list