[haXe] Type inferrence problem

Michael Pliskin pl at tepkom.ru
Wed Aug 2 07:47:13 CEST 2006


Hello Nicolas,

NC> If you read carefully the error message, you will see that it prints
NC> "Inconsistent getter for field nodeValue".

NC> That will give you an tip on what's going wrong : since you access the
NC> s.iterator whitout knowing its type, it deduces since this is an 
NC> iterator over objets having a "normal field" nodeValue, while 
NC> Xml.nodeValue has a getter/setter.

NC> Hence the error, which is quite lengthy I agree, since it's quite deep
NC> in the unification phase.

Ok, I got what's going wrong inside the type inferrence engine here,
but I still do not think compiler should report error in this case.
Why does the it deduce that nodeValue is a normal field? It should
deduce that it is either normal field or a property (maybe assuming
normal field as a priority), and then solve this 'or' when it
understands that Xml.nodeValue is a property. I agree this is a
difficult case for the typer as properties bring some kind of
undeterminism to automatic inferrence - but it does not seem
impossible to make the right choice here.

-- 
Best regards,
 Michael                            mailto:pl at tepkom.ru




More information about the Haxe mailing list