https://issues.dlang.org/show_bug.cgi?id=24688

RazvanN <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |WONTFIX

--- Comment #3 from RazvanN <[email protected]> ---
What you are asking for is not a reasonable strategy. The type deduction
mechanism works by looking at the parameter type and binding T to 'const int'.
It's an elegant and simple to understand strategy. If you want tpl to be
instantiated with a mutable parameter you can just specify that at the call
site: 
`z = tpl!int(i);`.

Having the compiler deduce constraints from the template body (or worse: just
guess) is something that will complicate the implementation of the compiler and
it's gonna be a behavior that is hard to understand (it's not intuitive). There
will be a lot of gotcha moments for users when they have to guess what was the
type with which the compiler instantiated the template.

--

Reply via email to