std.algorithm.remove and principle of least astonishment

Steven Schveighoffer schveiguy at yahoo.com
Sat Oct 16 14:32:10 PDT 2010


On Sat, 16 Oct 2010 17:28:17 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 10/16/2010 02:58 PM, Tomek Sowiński wrote:
>> Andrei Alexandrescu napisał:
>>
>>> On 10/16/2010 01:39 PM, Steven Schveighoffer wrote:
>>>> I suggest wrapping a char[] or wchar[] (of all constancies) with a
>>>> special range that imposes the restrictions.
>>>
>>> I did so. It was called byDchar and it would accept a string type. It
>>> sucked.
>>
>> Why it sucked?
>
> Because 99% of the times you'd want to pass byDchar, but it was easy to  
> forget. Then the algorithm would compile and run without byDchar, just  
> with useless semantics.

So call it string, and make the compiler use it as the default type for  
string literals.

-Steve


More information about the Digitalmars-d mailing list