Templates problem

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 7 04:33:08 PDT 2016


On Wed, 2016-09-07 at 09:03 +0000, ketmar via Digitalmars-d-learn
wrote:
> […]
> 
> alas, no jokes here. within the current D sytnax there is simply 
> no way to make that error less cryptic. :-(

Well that will be the end of any traction for D then. C++, Java,
Groovy, etc. error messages prove that error reporting is something you
get right or you have no users that are not working under Stockholm
Syndrome.

> even pointing at the failed constraint is fairly hard with 
> current DMDFE code (that's why nobody did it yet), and show 
> custom error for that is nearly impossible. we can't write "catch 
> all" template with static assert, 'cause it catches everything, 
> which is not desirable.
> 
> i myself didn't found even acceptable solution for this mess. 
> sure, at least pointing to failed constraint is something we 
> should have, but in your case it is of little help, actually.
> 
> probably adding `map` overload which accepts static arrays and 
> does `static assert(0, "please use slice for static arrays");` 
> may help in this case.

I think bearophile suggested adding amap many moons ago.

I suspect this will never happen due to array(map(…)) which is fine.

-- 
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 winder.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: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20160907/a33aff95/attachment.sig>


More information about the Digitalmars-d-learn mailing list