Issue 11: next() not typed correctly.
Status:  Fixed
Owner:
Closed:  Jul 2010
Project Member Reported by gameh...@gmail.com, Apr 5, 2010

Hi,
There seems to be a problem with the type information
coming from the "next()" operator of the iterator.
This can't easily be fixed until the next update of the compiler.
In the mean time, you can work around this by using a temporary variable:
 
 
var next = iter.next();
var minRadius = next.getMinRadius();
 
Hope this works,
 
Hugh


Hi Hugh,
 
Was the bug at the to pof this thread ever resolved? (not box2d, but to do
with interfaces?)  I think I'm experiencing it but honestly I don't
understand hxcpp well enough to know what the issue is exactly.  I've
included the error below as well as excerpts from the relevant classes.  
Let
me know if there's an easy fix or some other code I can provide to
illustrate the problem if it's not a known one.  I'm using the latest haxe
(205) and latest nme, neash, hxcpp.
 
Error:
 
./src/drips/entities/InflatableGroup.cpp(130) : error C2039: 'getMinRadius'
: is not a member of 'hx::Object'
        C:\Program
Files\Motion-Twin\haxe\lib\hxcpp\2,05,1\include\hx/Object.h(53) : see
declaration of 'hx::Object'
 
 
[[[Related method in cpp:]]]
 
double InflatableGroup_obj::getSmallestMinRadius( ){
    __SAFE_POINT
    Dynamic iter = this->inflatables->iterator();
    double minRadius =
iter->__Field(HX_STRING(L"next",4))()->getMinRadius();
    for(Dynamic __it = iter;  __it->__Field(HX_STRING(L"hasNext",7))(); ){
::drips::entities::Inflatable i = __it->__Field(HX_STRING(L"next",4))();
        {
            minRadius = ::Math_obj::min(i->getMinRadius(),minRadius);
        }
;
        __SAFE_POINT
    }
    return minRadius;
}
 
 
[[[Excerpt of InflatableGroup.hx:]]]
 
    /** Get Smallest MinRadius */
    private function getSmallestMinRadius():Float
    {
        var iter:Iterator<Inflatable>=this.inflatables.iterator();
        var minRadius:Float=iter.next().getMinRadius();
        for (i in iter)
        {
            minRadius=Math.min(i.getMinRadius(),minRadius);
        }
        return minRadius;
    }
 
 
[[[Inflatable Interface:]]]
 
/** Inflatable */
interface Inflatable
{
    /** Set Group */
    function setGroup(group:InflatableGroup):Void;
 
    /** Inflate */
    function inflate(value:Float):Void;
 
    /** Set Radius */
    function setRadius(radius:Float):Void;
 
    /** Decrement Radius */
    function decRadius(val:Float):Void;
 
    /** Increment Radius */
    function incRadius(val:Float):Void;
 
    /** Get Radius */
    function getRadius():Float;
 
    /** Get Minimum Radius */
    function getMinRadius():Float;
}
Jul 26, 2010
Project Member #1 gameh...@gmail.com
class X
{
  public var x:Float;
  public function new(inX:Float) { x = inX; }
}


class Test {

	static function main() {
      var xs = new Array<X>();
      xs.push( new X(1) );
      var iter:Iterator<X>=xs.iterator();
      while(iter.hasNext())
         trace(iter.next().x);
	}

}

Jul 29, 2010
Project Member #2 gameh...@gmail.com
Fixed in haxe/hxcpp svn
Status: Fixed