docs/book chapter 5, part 1

Andrew Whitworth wknight8111 at gmail.com
Fri Feb 20 00:01:13 UTC 2009


Thanks, I've fixed these things in r36898. Most of chapter 5 needs
major rewrite and update. I should add a note at the top "here there
be dragons".

--Andrew Whitworth

On Thu, Feb 19, 2009 at 7:10 PM, Heiko <heiko at hexco.de> wrote:
> Hi,
>
> the saga continues...
>
> in chapter 5, line
> 323
> 324
> I don't see any exceptions in these examples.
>
> In line 428, it would be better to have an example
> without a deprecated operation.
>
> In line 989:
> 'Since regular expressions aren't implemented yet,'
> Is this information current?
>
> Good night,
> Heiko
>
>
> --- docs/book/ch05_pasm.pod.org 2009-02-19 23:45:52.234375000 +0100
> +++ docs/book/ch05_pasm.pod     2009-02-20 01:08:19.234375000 +0100
> @@ -205,7 +205,7 @@
>  N<Strings in Parrot use Copy-On-Write (COW) optimizations. When we
>  call C<set S1, S0> we copy the pointer only, so both registers point
>  to the same string memory. We don't actually make a copy of the string
> -until one of two registers is modified.> Just after C<set> C<S1>, C<S0>,
> +until one of two registers is modified.> Just after C<set S1, S0>,
>  both C<S0> and C<S1> point to the same string. But assigning a constant
>  string to a string register allocates a new string. When "Zaphod" is
>  assigned to C<S0>, the pointer changes to point to the location of the
> @@ -227,8 +227,8 @@
>   end
>
>  The C<new> opcode creates an instance of the C<.String> class. The
> -class's vtable methods define how the PMC in C<P0> operates.  The
> -first C<set> statement calls C<P0>'s vtable method
> +class's VTABLE methods define how the PMC in C<P0> operates.  The
> +first C<set> statement calls C<P0>'s VTABLE method
>  C<set_string_native>, which assigns the string "Ford" to the PMC. When
>  C<P0> is assigned to C<P1>:
>
> @@ -276,7 +276,7 @@
>  Z<CHP-5-SECT-2.2.3>
>
>  X<typemorphing>
> -The classes C<Undef>X<Undef PMC>, C<Int>,
> +The classes C<Undef>X<Undef PMC>, C<Int>X<Int PMC>,
>  C<Num>X<Num PMC>, and C<String>X<String PMC> implement
>  Perl's polymorphic scalar behavior. Assigning a string to a number PMC
>  morphs it into a string PMC. Assigning an integer value morphs it to a
> @@ -303,7 +303,7 @@
>
>  X<PASM (Parrot assembly language);math operations>
>  PASM has a full set of math instructions. These work with integers,
> -floating-point numbers, and PMCs that implement the vtable methods of
> +floating-point numbers, and PMCs that implement the VTABLE methods of
>  a numeric object. Most of the major math opcodes have two- and
>  three-argument forms:
>
> @@ -338,7 +338,7 @@
>   mul P0, P1, N2
>
>  X<PMCs (Polymorphic Containers);operations on>
> -Operations on a PMC are implemented by the vtable method of the
> +Operations on a PMC are implemented by the VTABLE method of the
>  destination (in the two-argument form) or the left source argument (in
>  the three argument form). The result of an operation is entirely
>  determined by the PMC.  A class implementing imaginary number
> @@ -373,10 +373,10 @@
>  Parrot provides C<add>X<add opcode (PASM)> (addition),
>  C<sub>X<sub opcode (PASM)> (subtraction), C<mul>X<mul opcode (PASM)>
>  (multiplication), C<div>X<div opcode (PASM)> (division), and C<pow>X<pow
> -opcode (PASM)> (exponent) opcodes, as well as two different modulus
> +opcode (PASM)> (exponentiation) opcodes, as well as two different modulus
>  operations. C<mod>X<mod opcode (PASM)> is Parrot's implementation of
>  modulus, and C<cmod>X<cmod opcode (PASM)> is the C<%> operator from
> -the C library. It also provides C<gcd>X<gcd opcode (PASM)> (greatest
> +the C language. It also provides C<gcd>X<gcd opcode (PASM)> (greatest
>  common divisor) and C<lcm>X<lcm opcode (PASM)> (least common
>  multiple).
>
> @@ -401,8 +401,8 @@
>  X<trigonometric functions (PASM)> trigonometric functions are in
>  radians:
>
> -  sin N1, N0
> -  exp N1, 2
> +  sin N1, N0   # N1 = sin(N0)
> +  exp N1, 2    # N1 = exp(2)
>
>  The majority of the floating-point operations have a single source
>  argument and a single destination argument. Even though the
> @@ -412,7 +412,7 @@
>  The C<atan>X<atan opcode (PASM)> opcode also has a three-argument
>  variant that implements C's C<atan2()>:
>
> -  atan N0, 1, 1
> +  atan N0, 1, 1   # N0 = atan(1,1)
>
>  =head2 Working with Strings
>
> @@ -655,7 +655,7 @@
>  Z<CHP-5-SECT-2.4.8>
>
>  X<PASM (Parrot assembly language);string operations;formatting
> -strings> The C<sprintf>X<sprintf opcode (PASM)> opcode generates a
> +strings>The C<sprintf>X<sprintf opcode (PASM)> opcode generates a
>  formatted string from a series of values. It takes three arguments:
>  the destination register, a string specifying the format, and an
>  ordered aggregate PMC (like a C<Array>) containing the values to
> @@ -920,7 +920,7 @@
>   print "\n"
>   end
>
> -The first eight lines create a C<Array> with two elements: a
> +The first eight lines create an C<Array> with two elements: an
>  C<Int> and a C<Num>. The format string of the C<sprintf> has
>  two format fields. The first, C<%#Px>, takes a PMC argument from the
>  aggregate (C<P>) and formats it as a hexadecimal integer (C<x>), with
> @@ -978,7 +978,7 @@
>   print S0             # prints "hi__0__1__0__parrot"
>   end
>
> -This example builds a C<Array> in C<P0> with the values C<"hi">,
> +This example builds an C<Array> in C<P0> with the values C<"hi">,
>  C<0>, C<1>, C<0>, and C<"parrot">. It then joins those values (separated
>  by the string C<"__">) into a single string, and stores it in C<S0>.
>
>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>
>


More information about the parrot-dev mailing list