Hi Victor --
You're not doing anything wrong, and are unfortunately running into a bug
in our implementation, listed in the STATUS file as: "Iterator methods
may not obey dynamic dispatch". The reason that the wording here is vague
is that it's not entirely clear to us (to me anyway) under what conditions
the bug manifests itself. For example, if I insert an "for i in 1..limit"
in each of your iterators, it seems to work.
I'm reasonably certain that the bug relates to an issue with iterator
inlining, and that if you compile with --no-inline-iterators, things
should work OK (at least, for your test program, things work for me).
Please give a shout if you find cases in which the --no-inline-iterators
flag doesn't seem to help.
Apologies for this bug which has been around longer than I'd care to
admit. I'll see if we can get someone on it for the upcoming release.
-Brad
On Wed, 4 Mar 2015, Victor Chaves wrote:
Hi,
I'm trying to choose dynamically which iterator to use, so I'm using class
inheritance with iterators inside them, like this:
class Abstract {
iter Iterator(limit: int) {
yield 0;
}
}
class Concrete : Abstract {
iter Iterator(limit: int) {
yield 1;
}
}
But if I write
var myclass : Abstract = new Concrete();
myclass.Iterator(n) yields 0 instead of 1.
Is there something I'm missing? Isn't Iterator supposed to get overriden?
Thanks.
--
Victor Chaves
Engenharia de Computação
Instituto Militar de Engenharia
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users