Sorry for the repost!
On 11/29/10, Andrej Mitrovic <[email protected]> wrote: > On 11/29/10, bearophile <[email protected]> wrote: >>> * Template pattern matching is incomplete >> >> I don't understand this, please explain better. But I think the syntax of >> is() is awful and I'd like to shoot it. >> > > +1. I'd prefer if we had a constraint block of some kind. I mean we > already have in/out contracts which look very nice: > > void somefunc() > in > { > // ...contract preconditions... > } > out (result) > { > // ...contract postconditions... > } > body > { > // ...code... > } > > Why not do the same for templates? Something like this: > > void foo(A, B, C)(A a, B b, C c) > constraint > { > isDynamicArray(a); > isIterable(a); > } > body > { > ... > } > > So maybe every statement would be checked for the return value, and > you would get the exact line where a constraint failed when > instantiating a template. > > Just a passing thought anyway.. >
