Why is std.algorithm so complicated to use?

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Jul 10 07:52:05 PDT 2012


On 10-Jul-12 17:59, H. S. Teoh wrote:
> On Tue, Jul 10, 2012 at 09:28:51AM -0400, Andrei Alexandrescu wrote:
>> On 7/10/12 2:50 AM, Jacob Carlborg wrote:
>>> On 2012-07-09 22:16, Andrei Alexandrescu wrote:
>>>
>>>> So foo is a range of strings, because each element of it is a
>>>> string.  Then you want to chain a range of strings with a string,
>>>> which is a range of dchar. That doesn't work, and I agree the error
>>>> message should be more informative.
>>>
>>> Is that by design or something that can be fixed?
>>
>> We can arrange things in the library that a custom message is issued,
>> or in the compiler to do it once for all.
>
> Please don't do it in the compiler. Custom messages should be in the
> library. Tying the compiler to phobos is a bad idea; druntime should be
> the only dependency.
>
>

Time and again I think of

T func(Blah)(Blah param)
	if(isMagic!Blah, Blah.stringof~" is not magic") //second param is an 
error hint
{
	
}

The idea is that when all functions from overload set fail to meet 
constraints the error on "doesn't match template parameters" should 
contain this extra HINTs on what's wrong.

HINT in general must be short, and clear. No need to do elobarate a 
statements.

-- 
Dmitry Olshansky




More information about the Digitalmars-d mailing list