[svn:parrot] r39674 - trunk/examples/tutorial

cotto at svn.parrot.org cotto at svn.parrot.org
Sat Jun 20 14:09:08 UTC 2009


Author: cotto
Date: Sat Jun 20 14:09:03 2009
New Revision: 39674
URL: https://trac.parrot.org/parrot/changeset/39674

Log:
[examples] use $P0 = new ['foo'] notation in examples

Modified:
   trunk/examples/tutorial/01_temp_var.pir
   trunk/examples/tutorial/02_local_var.pir
   trunk/examples/tutorial/03_temp_var_basic_pmcs.pir
   trunk/examples/tutorial/24_string_ops_clone.pir
   trunk/examples/tutorial/30_arrays_basic.pir
   trunk/examples/tutorial/32_array_ops_sprintf.pir
   trunk/examples/tutorial/33_hashes.pir
   trunk/examples/tutorial/34_multikey.pir
   trunk/examples/tutorial/40_file_ops.pir
   trunk/examples/tutorial/55_iterator.pir
   trunk/examples/tutorial/56_defined.pir
   trunk/examples/tutorial/57_exists.pir
   trunk/examples/tutorial/61_namespaces.pir
   trunk/examples/tutorial/70_class_object.pir
   trunk/examples/tutorial/81_continuation.pir

Modified: trunk/examples/tutorial/01_temp_var.pir
==============================================================================
--- trunk/examples/tutorial/01_temp_var.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/01_temp_var.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -23,7 +23,7 @@
 
     $S5 = "Hello"    # set temp string var to "Hello"
 
-    $P0 = new 'String'
+    $P0 = new ['String']
     $P0 = "Ford"     # set temp PMC var to "Ford"
 
     say $I0

Modified: trunk/examples/tutorial/02_local_var.pir
==============================================================================
--- trunk/examples/tutorial/02_local_var.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/02_local_var.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -36,7 +36,7 @@
     print "\n"
 
     .local pmc player
-    player = new 'String'
+    player = new ['String']
     player = "Ford"     # set temp PMC var to "Ford"
     print player
     print "\n"

Modified: trunk/examples/tutorial/03_temp_var_basic_pmcs.pir
==============================================================================
--- trunk/examples/tutorial/03_temp_var_basic_pmcs.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/03_temp_var_basic_pmcs.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -18,15 +18,15 @@
 =cut
 
 .sub main :main
-    $P0 = new 'Integer'
+    $P0 = new ['Integer']
     $P0 = 42
     say $P0
 
-    $P1 = new 'Float'
+    $P1 = new ['Float']
     $P1 = 6.35
     say $P1
 
-    $P2 = new 'ResizableStringArray'
+    $P2 = new ['ResizableStringArray']
     $P2[0] = "Foo"
     $P2[1] = "Bar"
     $P2[2] = "Baz"

Modified: trunk/examples/tutorial/24_string_ops_clone.pir
==============================================================================
--- trunk/examples/tutorial/24_string_ops_clone.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/24_string_ops_clone.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -14,7 +14,7 @@
 .sub main :main
     .local pmc firstname
 
-    firstname = new 'String'
+    firstname = new ['String']
     firstname = "Ford"
     say firstname
 

Modified: trunk/examples/tutorial/30_arrays_basic.pir
==============================================================================
--- trunk/examples/tutorial/30_arrays_basic.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/30_arrays_basic.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -18,7 +18,7 @@
 .sub main :main
 
     .local pmc myarray
-    myarray = new 'ResizableStringArray'
+    myarray = new ['ResizableStringArray']
 
     myarray[0] = "Foo"
     push myarray, "Bar"

Modified: trunk/examples/tutorial/32_array_ops_sprintf.pir
==============================================================================
--- trunk/examples/tutorial/32_array_ops_sprintf.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/32_array_ops_sprintf.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -14,13 +14,13 @@
 .sub main :main
 
     .local pmc myarray
-    myarray = new 'ResizablePMCArray'
+    myarray = new ['ResizablePMCArray']
 
-    $P0 = new 'Integer'
+    $P0 = new ['Integer']
     $P0 = 42
     push myarray, $P0
 
-    $P1 = new 'Float'
+    $P1 = new ['Float']
     $P1 = 10.5
     push myarray, $P1
 

Modified: trunk/examples/tutorial/33_hashes.pir
==============================================================================
--- trunk/examples/tutorial/33_hashes.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/33_hashes.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -22,7 +22,7 @@
 .sub main :main
 
     .local pmc myhash
-    myhash = new 'Hash'
+    myhash = new ['Hash']
 
     myhash['foo'] = 5
     myhash['bar'] = "Hello"

Modified: trunk/examples/tutorial/34_multikey.pir
==============================================================================
--- trunk/examples/tutorial/34_multikey.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/34_multikey.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -17,8 +17,8 @@
 .sub main :main
 
     .local pmc myhash, innerarray
-    myhash  = new 'Hash'
-    innerarray = new 'ResizableIntegerArray'
+    myhash  = new ['Hash']
+    innerarray = new ['ResizableIntegerArray']
 
     $I0 = 2
     innerarray[2] = 42

Modified: trunk/examples/tutorial/40_file_ops.pir
==============================================================================
--- trunk/examples/tutorial/40_file_ops.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/40_file_ops.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -20,7 +20,7 @@
     close filein
 
     # Be nice and remove the temporary file we created.
-    $P1 = new 'OS'
+    $P1 = new ['OS']
     $P1.'rm'('40_file_ops_data.txt')
 .end
 

Modified: trunk/examples/tutorial/55_iterator.pir
==============================================================================
--- trunk/examples/tutorial/55_iterator.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/55_iterator.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -21,7 +21,7 @@
 
     myarray = split " ", "foo bar baz boz"
 
-    iter = new 'Iterator', myarray
+    iter = new ['Iterator'], myarray
   iter_loop:
     unless iter goto iter_end
 

Modified: trunk/examples/tutorial/56_defined.pir
==============================================================================
--- trunk/examples/tutorial/56_defined.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/56_defined.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -15,7 +15,7 @@
 
 .sub main :main
 
-    $P1 = new 'String'
+    $P1 = new ['String']
     $I0 = defined $P1
     if $I0 goto defined_P1
         say "$P1 is undefined"
@@ -32,7 +32,7 @@
 =cut
 
   end_defined_P1:
-    $P3 = new 'Undef'
+    $P3 = new ['Undef']
     $I0 = defined $P3
     if $I0 goto defined_P3
         say "$P3 is undefined"

Modified: trunk/examples/tutorial/57_exists.pir
==============================================================================
--- trunk/examples/tutorial/57_exists.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/57_exists.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -23,10 +23,10 @@
 
     # set up an array with two elements
     .local pmc my_array
-    my_array = new 'ResizablePMCArray'
-    $P0      = new 'String'
+    my_array = new ['ResizablePMCArray']
+    $P0      = new ['String']
     $P0      = "Hello"
-    $P1      = new 'Undef'
+    $P1      = new ['Undef']
     push my_array, $P0
     push my_array, $P1
 

Modified: trunk/examples/tutorial/61_namespaces.pir
==============================================================================
--- trunk/examples/tutorial/61_namespaces.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/61_namespaces.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -20,7 +20,7 @@
 
 .sub main :main
 
-   $P0 = new 'String'
+   $P0 = new ['String']
    $P0 = "Hello"
    set_global ["Different"; "Namespace"], "foo", $P0
 

Modified: trunk/examples/tutorial/70_class_object.pir
==============================================================================
--- trunk/examples/tutorial/70_class_object.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/70_class_object.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -37,7 +37,7 @@
     addattribute myclass, 'bar'
     addattribute myclass, 'baz'
 
-    myobj = new 'Foo'
+    myobj = new ['Foo']
     myobj.'set_bar'("Hello")
     myobj.'set_baz'(5)
 
@@ -61,7 +61,7 @@
 .sub set_bar :method
     .param string value
 
-    $P0 = new 'String'
+    $P0 = new ['String']
     $P0 = value
     setattribute self, "bar", $P0
 .end
@@ -74,7 +74,7 @@
 .sub set_baz :method
     .param int value
 
-    $P0 = new 'Integer'
+    $P0 = new ['Integer']
     $P0 = value
     setattribute self, "baz", $P0
 .end

Modified: trunk/examples/tutorial/81_continuation.pir
==============================================================================
--- trunk/examples/tutorial/81_continuation.pir	Sat Jun 20 06:30:04 2009	(r39673)
+++ trunk/examples/tutorial/81_continuation.pir	Sat Jun 20 14:09:03 2009	(r39674)
@@ -15,7 +15,7 @@
 
 .sub main :main
     .local pmc cont
-    cont = new 'Continuation'
+    cont = new ['Continuation']
     set_addr cont, continued
 
     test_call(4, cont)


More information about the parrot-commits mailing list