Revision 27096

Date:
2009/06/16 20:25:26
Author:
moritz
Revision Log:
[S32/Containers] flesh out Buf constructor
Files:

Legend:

 
Added
 
Removed
 
Modified
  • docs/Perl6/Spec/S32-setting-library/Containers.pod

     
    736 736 class Buf does Positional {...}
    737 737
    738 738 A mutable container for an array of integer values in contiguous
    739 memory.
    739 memory. The default constructor takes a slurpy array parameter of
    740 integers, the largest of which determines the actual type. So
    740 741
    742 Buf.new(:16<c3>, :16<B6>) # or
    743 Buf.new(195, 182) # which is exactly the same
    744
    745 returns a C<buf8> containing two C<uint8> items, while
    746
    747 Buf.new(256)
    748
    749 returns a C<buf16> which consists of a single C<uint16>.
    750
    751 To explicit request a C<Buf> of a specific size, you can use
    752
    753 Buf.new(127, :size(16)) # returns a buf16
    754 Buf.new(1024, :size(8)) # dies, because 1024 >= 2**8
    755
    741 756 =head2 Pair
    742 757
    743 758 class Pair does Associative {...}