On Wednesday, 15 June 2016 at 07:08:22 UTC, Walter Bright wrote:
On 6/14/2016 9:57 PM, tsbockman wrote:
The intent is just as clear this way, and it's less verbose.
Ok. I'd just change the constraint to:
if (isIntegral!N || isCheckedint!N)
You can do the qualification machinations using a static if
inside the template.
This was a deliberate design decision, which I do not think
should be changed (although I will if you insist):
* With your signature, the user may wrongly expect SmartInt to
support qualified `N`. My scheme encodes the fact that only
unqualified
types are *really* supported in the public signatures.
(I should add an explanatory note about this in the docs,
too.)
* Your scheme will make uglier and more verbose error
messages and fully
qualified type signatures, as `SmartInt` will become
`SmartInt.SmartInt`
or `SmartIntImpl`. This is confusing for users who are not
familiar with
the details of D's template system, and still annoying for
the rest of us.
* Your scheme will also complicate the docs, as it will
replace the top-level
entry for `struct SmartInt` with a nested
`template SmartInt` => `struct SmartInt` entry.