Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] Iterator proof of concept

16 views
Skip to first unread message

Leopold Toetsch

unread,
Mar 22, 2003, 6:24:56 AM3/22/03
to P6I
After the overwhelming amount of f'ups to my proposal:
Subject: [RfC] Yet another iterator proposal.
Date: Mon, 10 Mar 2003 16:17:35 +0100
I (as well as our tireless summarizer) thought, the concept ought to be ok.
But a test says more then 1000 RfCs so here is a first step towards
implementation:
- only for arrays/integers currently
- only minimal aggregate semantics are implemented for the iterator
- 1 failing test, which is ok:
$ imcc t/pmc/pmc_70.pasm
Iterator init without aggregate
(init could be implemented, then e.g. C<assign PIter, Paggregate> for
attaching the aggregate to the iterator)

Comments welcome :-)
leo

PS playing with the patch needs "make realclean" as well as my latest
imcc commit from CVS.

iter_1.patch

Leopold Toetsch

unread,
Mar 24, 2003, 5:10:55 AM3/24/03
to Leopold Toetsch, P6I
Leopold Toetsch wrote:

> After the overwhelming amount of f'ups to my proposal:


Still :)

One more comment:

The iterator class is intended to pass almost every method on to the
aggregate, e.g.


> + PMC* getprop (STRING* key) {
> + return ((PMC *)SELF->data)->vtable->getprop(INTERP,
> + (PMC *)SELF->data, key);
> + }

I think, this is the same behavior as a reference. Hence the Iterator
class could inherit from a Ref class and just override iterator specific
functions.

Are there any thoughts about a Ref (or Reference) class?

leo

Leopold Toetsch

unread,
May 14, 2003, 5:44:46 AM5/14/03
to perl6-i...@perl.org, d...@sidhe.org
[ Again ]

> Leopold Toetsch wrote:

>> + PMC* getprop (STRING* key) {
>> + return ((PMC *)SELF->data)->vtable->getprop(INTERP,
>> + (PMC *)SELF->data, key);
>> + }

> I think, this is the same behavior as a reference. Hence the Iterator
> class could inherit from a Ref class and just override iterator specific
> functions.

> Are there any thoughts about a Ref (or Reference) class?

I really hate code duplication, so ...

Summary: The Iterator behaves like the aggregate it is attached to. All
the get_<type> methods would just delegate the method to the ->data
member as shown above for the C<getprop> method.

Is this the same as the functionality of a Reference class?

Thanks for answering,
leo

0 new messages