return type and templates

Dicebot public at dicebot.lv
Fri Nov 22 05:50:11 PST 2013


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. One can define some 
analysis rules that will make it do so but it is a very major 
change to compiler internals.


More information about the Digitalmars-d-learn mailing list