Ticket #1104: Number.Float.diff
File Number.Float.diff, 1.4 KB (added by jkeenan, 12 years ago) |
---|
-
docs/book/pir/ch04_variables.pod
1030 1030 X<PMCs (Polymorphic Containers);scalar> 1031 1031 In most of the examples shown so far, PMCs duplicate the behavior of integers, 1032 1032 numbers, and strings. Parrot provides a set of PMCs for this exact purpose. 1033 C<Integer>, C< Number>, and C<String> are thin overlays on Parrot's low-level1033 C<Integer>, C<Float>, and C<String> are thin overlays on Parrot's low-level 1034 1034 integers, numbers, and strings. 1035 1035 1036 1036 A previous example showed a string literal assigned to a PMC variable of type … … 1045 1045 $P1 = new 'String' 1046 1046 $P1 = "5 birds" 1047 1047 1048 $P2 = new ' Number'1048 $P2 = new 'Float' 1049 1049 $P2 = 3.14 1050 1050 1051 1051 =end PIR_FRAGMENT … … 1068 1068 $P1 = $S1 1069 1069 1070 1070 $N2 = 3.14 1071 $P2 = new ' Number'1071 $P2 = new 'Float' 1072 1072 $P2 = $N2 1073 1073 1074 1074 =end PIR_FRAGMENT … … 1082 1082 1083 1083 $P1 = box $S1 # $P1 is a "String" 1084 1084 1085 $P2 = box 3.14 # $P2 is a " Number"1085 $P2 = box 3.14 # $P2 is a "Float" 1086 1086 1087 1087 =end PIR_FRAGMENT 1088 1088 … … 1110 1110 1111 1111 =end PIR_FRAGMENT 1112 1112 1113 This example creates C<Integer>X<Integer PMC>, C< Number>X<NumberPMC>,1113 This example creates C<Integer>X<Integer PMC>, C<Float>X<Float PMC>, 1114 1114 and C<String>X<String PMC> PMCs, and shows the effect of assigning each 1115 1115 one back to a low-level type. 1116 1116