[haXe] Xml.attributes() and Iterable

Asger Ottar Alstrup asger at area9.dk
Mon Jan 29 12:00:47 CET 2007


Hi,

I'm trying to compile with haxe 1.11, but I get this error:

Running process: C:\Program Files\Motion-Twin\haxe\haxe.exe conceive.hxml
..\..\..\bohr\source\shared/TopicDataSerializer.hx:275: characters 14-168 :
Iterator<String> should be Iterable<Unknown<0>>
..\..\..\bohr\source\shared/TopicDataSerializer.hx:275: characters 14-168 :
{ next : Void -> String, hasNext : Void -> Bool } should be
Iterable<Unknown<0>>
..\..\..\bohr\source\shared/TopicDataSerializer.hx:275: characters 14-168 :
{ next : Void -> String, hasNext : Void -> Bool } should be { iterator :
Void -> Iterator<Unknown<0>> }
..\..\..\bohr\source\shared/TopicDataSerializer.hx:275: characters 14-168 :
{ next : Void -> String, hasNext : Void -> Bool } has no field iterator
..\..\..\bohr\source\shared/TopicDataSerializer.hx:275: characters 14-168 :
For function argument 'it'

and the code looks like this:


        var attrs = Lambda.fold(node.attributes(), function (a: String, arr:
Array<TopicContent>) { if ("id" != a) arr.push({name: a, value: node.get(a)});
return arr; }, []);
        var features = Lambda.fold(node.elements(), more stuff);

Now, I can change this to

        var iterable = function(it) {
            return { iterator : function() { return it; } }
        };
        var attrs = Lambda.fold(iterable(node.attributes()), function (a:
String, arr: Array<TopicContent>) { if ("id" != a) arr.push({name: a, value:
node.get(a)}); return arr; }, []);
        var features = Lambda.fold(node.lements(), more stuff);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070129/3f6d62b9/attachment.htm


More information about the Haxe mailing list