waneck / haxe-genc

20 stars 2 forks source link

Iterators #4

Closed Simn closed 11 years ago

Simn commented 11 years ago

I suspect these will be quite annoying to get right.

waneck commented 11 years ago

If we actually get a good way to deal with dynamic access directly from the vtable, Iterators may not even have to be a special case. Anyway, what I plan to do on Java/C# is to force a Iterator / Iterable interface implementation when iterator/hasNext/next functions are detected. Also transform anonymous object declaration into a real class, when functions are declared as well.

Simn commented 11 years ago

Indeed, iterators are no special case. I thought we might have to pull some tricks to support TFor, but it's actually just a TWhile with proper access on next and hasNext fields.