That #perl6 discussion on character strings over the last hour then
evolved into a discussion on binary strings, where the
pseudo-conclusion started here:
http://colabti.de/irclogger/irclogger_log/perl6?date=2006-08-09,Wed&sel=294#l520
And so, I formally propose the addition of an immutable and portable
arbitrary length "Blob" type, whose purpose is basically the same as
it is in databases, which is for arbitrary length binary data. It is
for storing arbitrary data whose internal structure you don't
necessarily know, but that you just want to preserve it as-is. Not
to say that you can't know its meaning, but that such knowledge just
isn't essential.
Like the immutable and portable Bool|Bit plus likewise and arbitrary
length Int|Num|Str types that we already have, the Blob type rounds
out a set of conceptually basic immutable and portable types over
which other more complicated types can be built.
An example description for Synopsis 6 could be:
Blob Perl binary string (finite sequence of bits)
For visual parity, the Str description could be slightly modified
with the addition of the word 'character':
Str Perl character string (finite sequence of Unicode characters)
I also want to emphasize that this "Blob" proposal is strictly an
addition, and all of the existing types mentioned in Synopsis 6 would
continue to exist, and with their current meanings. For example, all
of buf|Str|Buf are not made redundant by the addition of a Blob.
However, Buf.does(Blob).
Operators defined for the Blob type would include assignment, === and
!===, concatenation, substring, length, binary and|or|xor etc. In
addition, Blob would likely be the default type that pack() converts
to, and unpack() from, as well as what encryption or generic hashing
functions like MD5 or SHA1 naturally return in an extended sense;
though they may return integers in a local sense, the Blob can be a
sequence of those when they are being stored. Such hashed values are
normally treated as immutable once created. There would exist
operators to convert between a Blob and various Str representations
for transmission of the data through a text-only medium, such as
hexadecimal or octal etc.
Truly, a Blob type should be a very natural addition, and a final
missing link in some respects.
Thank you in advance.
-- Darren Duncan