Reducing template constraint verbosity? [was Re: Slides from my ACCU Silicon Valley talk]
Steven Schveighoffer
schveiguy at yahoo.com
Tue Dec 14 13:12:59 PST 2010
On Tue, 14 Dec 2010 16:03:18 -0500, so <so at so.do> wrote:
> It is exactly your proposal (first one to match wins), with uglier
> syntax :D
Not exactly. It fits within the syntax of D (if-else), and order of
evaluation is explicit, whereas one might expect with my original proposal
that order does not matter. There is no disputing which template should
be instantiated. But yes, it is the same premise.
And I don't agree the syntax is uglier. Maintenance would be easier (only
one signature need be modified). Also only need to document in one spot.
> Would it even fulfill your requirements? For example "What if I don't
> have control over that module?"
> This one would make it impossible.
It doesn't fulfill that requirement, no. But it gets us less verbose
definition where you do control the module. Solving some of the
requirements without solving them all is allowed.
Actually, now that I think about it, that kind of fits D as well.
Overload resolution is not done across modules.
-Steve
More information about the Digitalmars-d
mailing list