On Fri, Sep 06, 2002 at 01:34:56AM -0400, Aaron Sherman wrote:

> # INTERNAL q, qq, qw
> # XXX - how do I do quote-like operators? I know I saw someone say...
> # Need to do: qr (NEVER("qr")) and qx

presumably the way the perl5 tokeniser does them - by parsing the string
into a series of concatenated constants and variables, with some optionally
fed through uc/ucfirst/lc/lcfirst/quotemeta
(And scalar and list interpolators breaking back out to the real parser)

> sub chomp($string is rw){
>       my $irs = ${"/"}; # XXX What is $/ now?

per file handle. So does that mean each string needs a property to hold what
the record separator for the file handle it was read from at the time of
reading?
(Well, as record separators could be regexps^Wpatterns actually I think a
an offset to the start of the record separator will do)


> sub index($string, $substr, int $pos //= 0) {
>       # XXX - slow dumb way... need to break out Knuth
>       my $sl = $substr.length;
>       for(my $i = $pos; $i+$sl <= $string.length; $i++) {
>               return $i if substr($string,$i,$sl) eq $substr;
>       }
>       return -1;
> }
> sub rindex($string, $substr, $pos //= 0) {
>       # XXX - slow dumb way
>       my $sl = $substr.length;
>       for(my $i = $string.length-$sl; $i >= $pos; $i--) {
>               return $i if substr($string,$i,$sl) eq $substr;
>       }
>       return -1;
> }     

I think that string in string searches are common functionality that ought
to be implemented in the parrot core. Rather than every language and
extension that needs them having to re-implement the wheel.
(Also, I confess that I'm not up-to-date on following the parrot source, so
I don't know if the PMC v-tables for strings contain entries for these.
That would allow index where both strings had the same (or compatible)
encodings to run more quickly)


> ############# IO
> # IO::... stuff to be moved out into IO classes:

> # sub socketpair($socket1,$socket2,$domain,$type,$protocol) { NEVER("socketpair") }

Why is socketpair never? It's a real Unix system call that provides
something that is impossible to completely fake from userspace
[connected Unix domain sockets with neither end bounce to an address]

Nicholas Clark

Reply via email to