Author: pmichaud
Date: Mon Dec 8 07:24:56 2008
New Revision: 33654
Modified:
branches/assign/languages/perl6/src/classes/List.pir
branches/assign/languages/perl6/src/classes/Object.pir
Log:
[rakudo]: more code adjustments
Modified: branches/assign/languages/perl6/src/classes/List.pir
==============================================================================
--- branches/assign/languages/perl6/src/classes/List.pir (original)
+++ branches/assign/languages/perl6/src/classes/List.pir Mon Dec 8
07:24:56 2008
@@ -17,7 +17,7 @@
# '!EXPORT'('first grep keys kv map pairs reduce values', $P0)
.end
-=head2 Context methods
+=head2 Methods
=over
@@ -32,6 +32,12 @@
.return (self)
.end
+.namespace []
+.sub 'list'
+ .param pmc values :slurpy
+ .tailcall values.'!flatten'()
+.end
+
=back
=head2 Coercion methods
@@ -42,6 +48,7 @@
=cut
+.namespace ['List']
.sub 'Iterator' :method
self.'!flatten'()
$P0 = new 'Iterator', self
@@ -686,24 +693,13 @@
=over 4
-=item C<list(...)>
-
-Build a flattened List from its arguments.
-
-=cut
-
-.namespace []
-.sub 'list'
- .param pmc values :slurpy
- .tailcall values.'!flatten'()
-.end
-
=item C<infix:,(...)>
Operator form for building a list from its arguments.
=cut
+.namespace []
.sub 'infix:,'
.param pmc args :slurpy
.tailcall args.'list'()
Modified: branches/assign/languages/perl6/src/classes/Object.pir
==============================================================================
--- branches/assign/languages/perl6/src/classes/Object.pir (original)
+++ branches/assign/languages/perl6/src/classes/Object.pir Mon Dec 8
07:24:56 2008
@@ -12,14 +12,6 @@
name and method trickery here and there, and this file takes
care of much of that.
-=head2 Initializers
-
-=over
-
-=item onload()
-
-Perform initializations and create the base classes.
-
=cut
.namespace []
@@ -32,12 +24,35 @@
set_hll_global ['Perl6Object'], '$!P6META', p6meta
.end
-=back
-
-=head2 Context methods
+=head2 Methods
=over 4
+=item defined()
+
+Return true if the object is defined.
+
+=cut
+
+.namespace ['Perl6Object']
+.sub 'defined' :method
+ $P0 = get_hll_global ['Bool'], 'True'
+ .return ($P0)
+.end
+
+
+=item hash
+
+Return invocant in hash context. Default is to build a Hash from C<.list>.
+
+=cut
+
+.namespace ['Perl6Object']
+.sub 'hash' :method
+ $P0 = self.'list'()
+ .tailcall $P0.'hash'()
+.end
+
=item item
Return invocant in item context. Default is to return self.
@@ -55,22 +70,46 @@
=cut
+.namespace ['Perl6Object']
.sub 'list' :method
$P0 = new 'List'
push $P0, self
.return ($P0)
.end
-=item hash
+=item print()
-Return invocant in hash context. Default is to build a Hash from C<.list>.
+Print the object.
=cut
.namespace ['Perl6Object']
-.sub 'hash' :method
- $P0 = self.'list'()
- .tailcall $P0.'hash'()
+.sub 'print' :method
+ $P0 = get_hll_global 'print'
+ .tailcall $P0(self)
+.end
+
+=item say()
+
+Print the object, followed by a newline.
+
+=cut
+
+.namespace ['Perl6Object']
+.sub 'say' :method
+ $P0 = get_hll_global 'say'
+ .tailcall $P0(self)
+.end
+
+=item true()
+
+Boolean value of object -- defaults to C<.defined> (S02).
+
+=cut
+
+.namespace ['Perl6Object']
+.sub 'true' :method
+ .tailcall self.'defined'()
.end
=back
@@ -83,6 +122,7 @@
=cut
+.namespace ['Perl6Object']
.sub 'Array' :method
$P0 = new 'Perl6Array'
'infix:='($P0, self)
@@ -133,61 +173,17 @@
=back
-=head2 Methods
+=head2 Special methods
=over 4
-=item defined()
-
-Return true if the object is defined.
-
-=cut
-
-.sub 'defined' :method
- $P0 = get_hll_global ['Bool'], 'True'
- .return ($P0)
-.end
-
-=item print()
-
-Print the object.
-
-=cut
-
-.sub 'print' :method
- $P0 = get_hll_global 'print'
- .tailcall $P0(self)
-.end
-
-=item say()
-
-Print the object, followed by a newline.
-
-=cut
-
-.sub 'say' :method
- $P0 = get_hll_global 'say'
- .tailcall $P0(self)
-.end
-
-=item true()
-
-Boolean value of object -- defaults to C<.defined> (S02).
-
-=cut
-
-.sub 'true' :method
- .tailcall self.'defined'()
-.end
-
-=item Special methods
-
=item new()
Create a new object having the same class as the invocant.
=cut
+.namespace ['Perl6Object']
.sub 'new' :method
.param pmc init_parents :slurpy
.param pmc init_this :named :slurpy
@@ -443,6 +439,7 @@
=cut
+.namespace ['Perl6Object']
.sub '!cloneattr' :method
.param string attrlist
.local pmc p6meta, result
@@ -574,6 +571,7 @@
=cut
+.namespace ['Perl6Object']
.sub '' :vtable('decrement') :method
$P0 = self.'pred'()
'infix:='(self, $P0)