New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PATCH: Add .get method to Iterator #913
Comments
From @skidsprefix:<=> has been summarily executed. |
From @skids0001-Add-.get-to-Iterator.patchFrom 49abde08f49bb6b3b3a201bc8599fcb093549102 Mon Sep 17 00:00:00 2001
From: root <root@charon.clarku.edu>
Date: Sun, 19 Apr 2009 15:04:17 -0400
Subject: [PATCH] Add .get to Iterator.
Also added name=>Iterator to class constructor
---
src/classes/Iterator.pir | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/classes/Iterator.pir b/src/classes/Iterator.pir
index eed4fae..aca7f38 100644
--- a/src/classes/Iterator.pir
+++ b/src/classes/Iterator.pir
@@ -17,8 +17,29 @@ Iterator - Perl 6 iterator
.sub 'onload' :anon :init :load
.local pmc p6meta, iterproto
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
- iterproto = p6meta.'new_class'('Perl6Iterator', 'parent'=>'Any')
+ iterproto = p6meta.'new_class'('Perl6Iterator', 'parent'=>'Any', 'name'=>'Iterator')
p6meta.'register'('Iterator', 'parent'=>iterproto, 'protoobject'=>iterproto)
+
+ $P0 = get_hll_namespace ['Perl6Iterator']
+ '!EXPORT'('get', 'from'=>$P0, 'to_p6_multi'=>1)
+.end
+
+=head2 Methods
+
+=over
+
+=item get
+
+Returns the value at the current position in the Iterator and
+prepares the Iterator to read the next value the next time
+C<get> is invoked on it.
+
+=cut
+
+.namespace ['Perl6Iterator']
+.sub 'get' :method
+ $P0 = shift self
+ .return ($P0)
.end
=back
--
1.6.2.2
|
From @moritzOn Sun Apr 19 12:38:24 2009, bri@abrij.org wrote:
Thank you very much for your patch. I'm a bit confused though - why is prefix:<=> in IO.pir, while .get is Cheers, |
The RT System itself - Status changed from 'new' to 'open' |
From @skidsOn Sun, 19 Apr 2009, Moritz Lenz via RT wrote:
Iterator will support .get. It's unclear whether IO will as well, Even if both support .get, Iterators and IO objects will have different As I did not know what the eventual intent was with IO, I did not try |
From @pmichaudOn Sun, Apr 19, 2009 at 07:38:07PM -0400, Brian S. Julin wrote:
It's fairly certain that IO will use .get -- indeed, it
Iterator probably ought to become a role instead of a class. Pm |
From @jnthnPatch will not be relevant now since Iterator has been totally |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#64858 (status was 'resolved')
Searchable as RT64858$
The text was updated successfully, but these errors were encountered: