Leopold Toetsch wrote:

cvsuser     04/12/10 02:15:20

  Modified:    classes  perlstring.pmc string.pmc
               t/pmc    perlstring.t
  Log:
  class refactoring 4 - String

[snip]

  -=item C<void* invoke(void* next)>
  -
  -Pythonic object constructor. SELF is a PerlString Class object. Return a new
  -C<str> object according to 2.1. Built-in Functions.

IMHO, all of these can go. The invoke methods need to be on the PMCs returned by get_class.


Some Python objects (examples: function, generator) have invoke methods. The way to create new instances of Python objects it to get the corresponding class object and invoke it.

  -=head2 Iterator Interface
  -
  -=over 4
  -
  -=item C<PMC* slice (PMC *key, INTVAL f)>
  -
  -Return a new iterator for the slice PMC C<key> if f==0.
  -
  -Return a new pythonic slice if f == 1.

IMHO, the notion of a "pythonic slice" can go. I found the following adquate for my needs:


  delete x[low .. high]
  x = y[low .. high]
  x[low .. high] = y

As an aside, the notion corresponding to a Parrot Key in python is actually a triple: [low:high:incr], where the increment defaults to 1.

- Sam Ruby

Reply via email to