On Fri, 2002-09-06 at 09:29, Nicholas Clark wrote: > 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)
Ok, so I guess that all has to go in the parser, not the builtins. Perl 5 already provides builtin functions that are the back-ends for things like C<< <> >>, C<qx>, etc so those will be in the builtins, and the parser can just call them. It may already do so, I've not had time to look. > > 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? That's not terribly useful, since filehandles will auto-chomp in Perl 6 anyway. I propose the alternate: sub chomp($string is rw, $sep //= rx/\n/) { ... } sub chomp(@strings is rw, $sep //= rx/\n/) { ... } This will mean that you can: chomp(@lines=<>) but not: chomp($line1, $line2, $line3); Is that going to be a problem? > (Well, as record separators could be regexps^Wpatterns actually I think a > an offset to the start of the record separator will do) I forgot they could be patterns. Need to go fix that! > > sub index($string, $substr, int $pos //= 0) { > > # XXX - slow dumb way... need to break out Knuth [...] > 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. Good point. I will look at what parrot does now, and consider moving index over to the Internal section. > Why is socketpair never? It's a real Unix system call that provides Because I was tired :) I'm going to cut that section down to just a list of the functions that need to be moved over to the IO modules as one long comment. It's just there for a reminder right now. Thanks for the comments and answers to some of my questions. The feedback as been quite helpful!