Bartosz Milewski seems to like D more than C++ now :)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 20 08:34:49 PDT 2013


On 9/20/13 3:47 AM, Dmitry Olshansky wrote:
> 20-Sep-2013 14:00, Jacob Carlborg пишет:
>> On 2013-09-20 11:37, Szymon Gatner wrote:
>>
>>> If only std algorithms took containers (by that I mean things that
>>> container for accepts too) as arguments (and not iterators)... even in
>>> the form of new functions like foreach_all, transform_all etc.
>>
>> Can't a container be a range as well?
>>
>
> For Christ sake no, no and no. For starters range skips/drops elements
> when iterating, and thusly iteration has its own state that is useless
> for a container otherwise.
>
> The idea of "contange" spreads like virus, no matter how abominable the
> end result is. The fact that slices sometimes look like containers (BTW
> ill-suited for anything beyond primitives/PODish stuff )  must be the
> corner stone of this belief. Strengthened on the motto of trying to make
> user defined types to mimic behavior of built-ins it leads to a school
> of thought that it's fine to blend ownership and access.
>
> TL;DR: Suboptimal, unnatural and error prone are keywords.

Agreed. A container is a range factory.

Andrei



More information about the Digitalmars-d mailing list