reddit discussion about Go turns to D again

Daniel Gibson metalcaedes at gmail.com
Sun May 15 20:18:51 PDT 2011


Am 16.05.2011 05:06, schrieb Andrei Alexandrescu:
> On 05/15/2011 10:04 PM, Daniel Gibson wrote:
>> Am 16.05.2011 04:59, schrieb Andrei Alexandrescu:
>>> 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
>>
>> So you have to write
>> std.parallel_algorithm.map() instead of map() all the time?
>
> alias std.parallel_algorithm p;
>
>
> Andrei

Right, I haven't thought about using alias.

Cheers,
- Daniel


More information about the Digitalmars-d mailing list