Skip to content

Commit

Permalink
[OO] Changed more PMC creation from constant syntax to string style.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@20926 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
chromatic committed Aug 30, 2007
1 parent 82c7cf6 commit 757c937
Show file tree
Hide file tree
Showing 149 changed files with 1,112 additions and 1,109 deletions.
14 changes: 7 additions & 7 deletions docs/art/pp002-pmc.pod
Expand Up @@ -203,7 +203,7 @@ something similar?

Nope. If you want to access environment variables I<you>
need to create a PMC of type C<Env>. This is accomplished by
the C<new> opcode like so: C<$P0 = new .Env> After that
the C<new> opcode like so: C<$P0 = new 'Env'> After that
statement, C<$P0> will contain a hash consisting of all of
the environment variables at that time. All built-in types
are prefixed with a dot, so if the PMC type is
Expand Down Expand Up @@ -231,8 +231,8 @@ environment variables:
.local pmc env, iter
.local string key, value

env = new .Env # line 3
iter = new .Iterator, env # line 4
env = new 'Env' # line 3
iter = new 'Iterator', env # line 4
iterloop:
unless iter goto iterend
key = shift iter # line 8
Expand Down Expand Up @@ -274,7 +274,7 @@ over the command line this same way? Sure!
.sub _ :main
.param pmc args
.local pmc cmdline
cmdline = new .Iterator, args
cmdline = new 'Iterator', args
loop:
unless cmdline goto end_loop
$S0 = shift cmdline
Expand Down Expand Up @@ -307,7 +307,7 @@ distribution (parrot/docs)
=head3 Example 7: Output random numbers

.sub _ :main
$P0 = new .Random
$P0 = new 'Random'
$N0 = $P0
print $N0
print "\n"
Expand All @@ -319,7 +319,7 @@ distribution (parrot/docs)
=head3 Example 8: Triggering an exception

.sub _ :main
$P0 = new .Exception
$P0 = new 'Exception'
$P0['_message'] = "The sky is falling!"
throw $P0
.end
Expand All @@ -333,7 +333,7 @@ distribution (parrot/docs)
.end

.sub _ :main
$P0 = new .Timer
$P0 = new 'Timer'
$P1 = global "expired"

$P0[.PARROT_TIMER_HANDLER] = $P1 # call sub in $P1 when timer goes off
Expand Down
6 changes: 3 additions & 3 deletions docs/art/pp003-oop.pod
Expand Up @@ -226,7 +226,7 @@ same for the rest):

.local pmc dog
dog = new "Dog"
$P0 = new .String
$P0 = new "String"
$P0 = "Phideaux"
setattribute dog, "name", $P0

Expand All @@ -253,7 +253,7 @@ the value, it does nothing more.

Next, I create a new Dog and give it a name. Because
attributes may only be PMCs, in order to give the Dog a
name, I first have to create a new .String PMC (this is one
name, I first have to create a new String PMC (this is one
of the PMCs builtin to Parrot) and assign the name I wish
to give the dog to this PMC. Then I can pass this PMC as a
parameter to C<setattribute> to give my Dog a name.
Expand Down Expand Up @@ -336,7 +336,7 @@ Jonathan Scott Duff

.sub setname :method
.param string name
$P0 = new .String
$P0 = new 'String'
$P0 = name
setattribute self, "name", $P0
.end
Expand Down
2 changes: 1 addition & 1 deletion docs/book/ch03_pir_basics.pod
Expand Up @@ -299,7 +299,7 @@ a higher score and spills the variables with a lower score. In this
example it picks C<$I1> and C<$I2>. Behind the scenes, Parrot
generates code to store the values:

new P31, .PerlArray
new P31, "PerlArray"
...
set I0, 1 # I0 allocated to $I1
set P31[0], I0 # spill $I1
Expand Down

0 comments on commit 757c937

Please sign in to comment.