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

Re: ???strict??? strings?

Thread Previous | Thread Next
Ricardo Signes
January 7, 2020 01:25
Re: ???strict??? strings?
Message ID:
It seems worth relating a discussion that Karl W. and I had in Salt Lake City some years ago.

The idea was that all strings would be given a three-value state:

1. Character string
2. Byte string
3. Lax/unknown string

# I am making up these QLOPs on the spot.
my $c = qc{Character string};
my $b = qb{Byte string};
my $x = q{Lax string};

$c . $c;   # yields a character string
$b . $b;   # yields a byte string
$x . $any; # yields a lax string
$c . $b;   # runtime error

This would provide the starting ground for making it possible to build type discipline into the runtime. Mostly, you'd have to mark strings as typed as you go. A PerlIO layer could type data as it was read. It's not entirely unlike taint. It was an interesting conversation, but didn't really lead to any action. I think our primary concern, apart from "will it get used and be useful?" was "how badly will XS code screw up its usefulness?". It's been a while.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About