Author: moritz
Date: 2009-06-16 22:25:26 +0200 (Tue, 16 Jun 2009)
New Revision: 27096

Modified:
   docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[S32/Containers] flesh out Buf constructor

Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:13:57 UTC 
(rev 27095)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod  2009-06-16 20:25:26 UTC 
(rev 27096)
@@ -736,8 +736,23 @@
     class Buf does Positional {...}
 
 A mutable container for an array of integer values in contiguous
-memory.
+memory. The default constructor takes a slurpy array parameter of
+integers, the largest of which determines the actual type. So
 
+    Buf.new(:16<c3>, :16<B6>) # or
+    Buf.new(195, 182)         # which is exactly the same
+
+returns a C<buf8> containing two C<uint8> items, while
+
+    Buf.new(256)
+
+returns a C<buf16> which consists of a single C<uint16>.
+
+To explicit request a C<Buf> of a specific size, you can use
+
+    Buf.new(127, :size(16))     # returns a buf16
+    Buf.new(1024, :size(8))     # dies, because 1024 >= 2**8
+
 =head2 Pair
 
     class Pair does Associative {...}

Reply via email to