Author: lwall
Date: 2009-09-02 21:56:15 +0200 (Wed, 02 Sep 2009)
New Revision: 28173
Modified:
docs/Perl6/Spec/S02-bits.pod
Log:
[S02] document Rat and Complex literals
Modified: docs/Perl6/Spec/S02-bits.pod
===================================================================
--- docs/Perl6/Spec/S02-bits.pod 2009-09-02 19:48:23 UTC (rev 28172)
+++ docs/Perl6/Spec/S02-bits.pod 2009-09-02 19:56:15 UTC (rev 28173)
@@ -13,8 +13,8 @@
Created: 10 Aug 2004
- Last Modified: 31 Aug 2009
- Version: 176
+ Last Modified: 2 Sep 2009
+ Version: 177
This document summarizes Apocalypse 2, which covers small-scale
lexical items and typological issues. (These Synopses also contain
@@ -2553,6 +2553,38 @@
=item *
+Rational literals are indicated by separating two integer literals
+(in any radix) with a slash. Whitespace is not allowed on either
+side of the slash:
+
+ 1/2 # one half literal Rat
+ 1 / 2 # 1 divided by 2 (also produces a Rat by constant folding)
+
+Note that this essentially overrides precedence to produce a term, so:
+
+ 1/2 * 3/4
+
+means
+
+ (1 / 2) * (3 / 4)
+
+rather than
+
+ ((1 / 2) * 3) / 4
+
+=item *
+
+Complex literals are similarly indicated by writing an addition of
+two real numbers without spaces:
+
+ 5.2+1e42i
+
+As with rational literals, constant folding would produce the same
+complex number, but this form parses as a single term, ignoring
+surrounding precedence.
+
+=item *
+
Characters indexed by hex numbers can be interpolated into strings
by introducing with C<"\x">, followed by either a bare hex number
(C<"\x263a">) or a hex number in square brackets (C<"\x[263a]">).