return type and templates
Timon Gehr
timon.gehr at gmx.ch
Fri Nov 22 06:20:30 PST 2013
On 11/22/2013 02:50 PM, Dicebot wrote:
> On Friday, 22 November 2013 at 13:43:49 UTC, Andrea Fontana wrote:
>> I assumed that it knows - when is trying to instatiate s.value
>> template - that "s.value" is part of an assignment and that it will be
>> assigned to an int.
>
> This is somewhat wrong part. "s.value" is distinct separate expression
> that must be evaluated by compiler on its own before proceeding. The
> fact that it is later used in assignment expression is not know at that
> moment.
Lambda parameter type deduction needs to know this too.
> One can define some analysis rules that will make it do so but
> it is a very major change to compiler internals.
Do you know the relevant compiler internals? I cannot really imagine it
being a major change. (It wouldn't be in the D frontend I am currently
developing as a side project.)
More information about the Digitalmars-d-learn
mailing list