On Sat Sep 06 18:26:02 2008, cotto wrote: > On Tue Feb 05 06:50:24 2008, coke wrote: > > On Wed Aug 16 23:09:16 2006, mdiep wrote: > > > I don't know how to write a test for this off the top of my head, but > > > Iterator and DynLexPad don't play well together atm. When I tried, I > > > got this error: > > > > > > elements() not implemented in class 'DynLexPad' > > > > > > Is there an easy way to make an arbitrary hash-like PMC (DynLexPad, > > > NameSpace, etc.) play well with iterator? > > > > > > Tcl needs to be able to iterate over the keys to return a list of all > > > the variables in the current procedure/lexpad. (See [info vars]) > > > > > > -- > > > Matt Diephouse > > > > > > > A nice cage task would be to write a test demonstrating the use of an > > iterator in this case. > > As of r30844 there's a TODO'd test for this, but some work will need to > be done to make DynLexPads (and LexPads, incidentally) iterable. Since > DynLexPads are based on Hashes, I imagine most of the work will be in > adapting get_iter and get_*_keyed.
The TODO'd test here is flawed - it contains debug out that will never match. It also assumes that the lexpad's iter will return things in order, which seems overly optimistic. A potential fix to the not-providing-iter solution is to just have this PMC extend Hash. -- Will "Coke" Coleda _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
