On May 24, 2008, at 5:47 PM, Greg Ewing wrote:

> Dag Sverre Seljebotn wrote:
>
>> This kind of suggest that rather than trying to take coercion out of
>> analyse_types and put it after (as we've talked about earlier), it  
>> could
>> be simpler and more natural to rather take the simplest "typing  
>> declared
>> variables" out in a new phase before analyse_types?
>
> I was just thinking about that. The type analysis phase is
> already doing a simple form of type inference when it works
> out the result type of an expression from its operand types.
> Full-blown type inference might be better seen as a
> generalisation of that rather than separate process.

Yep.

When we say type inference, we're talking about the broader problem  
of inferring the types of variables that are not explicitly declared.  
For example, if I write

     y = x+1

(say, as my only assignment to y) then the type of y would depend on  
the type of x. Of course there could be circular and multiple  
dependancies, so there needs to be one pass to figure out the  
declarations/dependancies, then a constraint solving algorithm to  
work out all the types, then another pass to actually use the deduced  
types to insert coercion nodes.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to