develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34160 - trunk/languages/perl6/src/classes

From:
pmichaud
Date:
December 20, 2008 12:18
Subject:
[svn:parrot] r34160 - trunk/languages/perl6/src/classes
Message ID:
20081220201845.CE619CBA12@x12.develooper.com
Author: pmichaud
Date: Sat Dec 20 12:18:44 2008
New Revision: 34160

Modified:
   trunk/languages/perl6/src/classes/IO.pir

Log:
[spec]:  Refactor IO.readline and prefix:<=>.


Modified: trunk/languages/perl6/src/classes/IO.pir
==============================================================================
--- trunk/languages/perl6/src/classes/IO.pir	(original)
+++ trunk/languages/perl6/src/classes/IO.pir	Sat Dec 20 12:18:44 2008
@@ -18,7 +18,7 @@
     p6meta.'new_class'('IOIterator', 'parent'=>'Perl6Object', 'attr'=>'$!IO')
 
     $P0 = get_hll_namespace ['IO']
-    '!EXPORT'('lines', 'from'=>$P0)
+    '!EXPORT'('lines,readline', 'from'=>$P0)
 .end
 
 =head2 Methods
@@ -134,11 +134,9 @@
 =cut
 
 .sub 'readline' :method
-    .local pmc PIO, chomper
-    PIO = getattribute self, "$!PIO"
-    $P0 = PIO.'readline'()
-    chomper = get_hll_global 'chomp'
-    .tailcall chomper($P0)
+    $P0 = get_hll_global 'IOIterator'
+    $P0 = $P0.'new'('IO' => self)
+    .return ($P0)
 .end
 
 
@@ -187,9 +185,7 @@
 .namespace []
 .sub 'prefix:=' :multi('IO')
     .param pmc io
-    $P0 = get_hll_global 'IOIterator'
-    $P0 = $P0.'new'('IO' => io)
-    .return($P0)
+    .tailcall io.'readline'()
 .end
 
 =back



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About