On Tue, Jul 12, 2005 at 04:53:49AM -0000, David Formosa (aka ? the Platypus) wrote: : How do we intend to manipulate raw binary in Perl6? Perl5's use : bytes; pragma is rather poor (forcing all strings to be raw in its : scope or requiring do {use bytes; ...} type tricks to deal with them) : and now Perl6 has real typing perhaps it would be more usefull to have : a bytestring type (or and octect string type) that doesn't get : utf8ed.
I've said that string types will be allowed to specify a minimum and maximum abstraction level. Byte strings merely specify a maximum abstraction level of bytes, and then any code that looks at it as codepoints, graphemes, or characters will only see values in the range of 0..255, and any attempt to store a character larger than 255 into such a string will fail. On the other extreme we can have abstract string types that encapsulate their representation, so that you're allowed to deal with them as graphemes or characters, but not get at their "true" representation, so you can't tell whether they're stored in UTF-8, UTF-32, UTF-EBCDIC, ASN.1, ISO-2022-jp, or Morse Code. As for naming string types, perhaps the main Str type can be parameterized. my ::bitstr ::= Str of bit; my ::bytestr ::= Str of uint8; my ::codestr ::= Str of Code; On the other hand, if the basic Str type is unwilling to take on the burden of being parameterized, we could generate all our funny string types by mapping a string name to an array declaration. my Str $foo is Array of byte; or some such. But maybe we can make Str of byte mean that by way of shorthand. Larry