[Mono-list] Iterator hello world.

Miguel de Icaza miguel@ximian.com
07 May 2003 10:38:23 -0400


Hello!

> For some reason this doesn't work (doesn't even compile).  If I remove
> GetMessage and the call to GetMessage everything works!
> 
> Is this a bug or shouldn't it be possible to have to iterators in the
> same class?

Thanks for catching this bug.  Turns out that I had a nice static
variable, that got overwritten because I reused the name without
noticing.  I have attached a patch that fixes this.

> In ruby you also have blocks which could be viewed as anonymous
> methods.  For example you could write this
> 
> DoTimes(3) {|x| print(x) }
> 
> I think I read that something like that was about to show up in C#? Am I
> correct?

You are correct.  In fact, a big chunk of the work for iterators will
get reused in anonymous methods (the remapping of parameters and local
variables in a method to be fields on a proxy class).

It is relatively simple to implement, but the spec for that new part of
the language has not been finished.

Miguel