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

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

From:
jonathan
Date:
December 17, 2008 06:36
Subject:
[svn:parrot] r34026 - trunk/languages/perl6/src/classes
Message ID:
20081217143632.40E62CBA12@x12.develooper.com
Author: jonathan
Date: Wed Dec 17 06:36:31 2008
New Revision: 34026

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

Log:
[rakudo] First cut of the clone method (argumentless version).

Modified: trunk/languages/perl6/src/classes/Object.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Object.pir	(original)
+++ trunk/languages/perl6/src/classes/Object.pir	Wed Dec 17 06:36:31 2008
@@ -28,6 +28,23 @@
 
 =over 4
 
+=item clone()
+
+Returns a copy of the object.
+
+=cut
+
+.namespace ['Perl6Object']
+.sub 'clone' :method
+    $I0 = isa self, 'ObjectRef'
+    unless $I0 goto do_clone
+    self = deref self
+  do_clone:
+    $P0 = clone self
+    .return ($P0)
+.end
+
+
 =item defined()
 
 Return true if the object is defined.



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