Eror message comprehensibility

Russel Winder russel at russel.org.uk
Wed Nov 17 04:12:29 PST 2010


I had accidentally written:

 immutable pi = 4.0 * reduce ! ( "a + b" ) ( 0 , outputData ) * delta ;

the error message received was:

Error: template instance std.algorithm.reduce!("a + b").reduce!(int,Map!(partialSum,Tuple!(int,int,double)[])) error instantiating

which isn't wrong, but neither is it that helpful.  Actually it is
helpful at all really.  Is there no way of saying in a more clear manner
"reduce initial value is an int but the type in the array is double so
they are not addition compatible."?

The correct line is of course:

 immutable pi = 4.0 * reduce ! ( "a + b" ) ( 0.0 , outputData ) * delta ;

but that isn't easily deducible from the error message presented.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101117/514d11cc/attachment.pgp>


More information about the Digitalmars-d mailing list