develooper Front page | perl.perl5.porters | Postings from January 2014

Re: Marking a scalar as an unupgradable binary blob.

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
January 28, 2014 11:29
Subject:
Re: Marking a scalar as an unupgradable binary blob.
Message ID:
52E79496.4080807@isolution.nl
On 2014-01-28 12:17, Zefram wrote:

> You can't introduce a type distinction into the current
> string type because it would break existing correct code such as
>
> 	sub decode_latin1 { $_[0] }
> 	$text_chars = $greeting_chars . decode_latin1($name_octets);
>
> The octet/character distinction is currently purely intensional, and can
> change with no explicit operation in the code.  Any labels that attempt
> to track that distinction will therefore get out of synch in existing
> correct code, even if they erase themselves at the first hint of an
> ambiguous process.

So we need a new string type.

use string;

and then let a string be a blessed arrayref, where each element is a 
substring, so a bare concatenate is effectively a push.

Each substring can be an object, etc.

-- 
Ruud


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About