We currently have two integer PMCs, we need another one for Python. But before just copy&paste another file, I'd really have done that right.

So first:
1) What are the semantics of Integer and PerlInt?
- do they overflow to BigInt?
- do they through exceptions on overflow?
- or silently wrap aound?
- do they integer (floor) divide?
- do they morph and if yes to which types, when?
...
2) Can one inherit from the other?

3) the new Py_int type:
- overflows silently to BigInt
- does integer (floor) divide for current Python, true_divide (i.e. result is float) for future Python or if this feature is imported from __future__.
- inherits from (maybe) PerlInt
- classname is "int" and isa("baseinteger")


4) Integer constructor (instantiation)
Python ints are instantiate like so (basically):

  int = global("int")  # class PMC
  $P0 = int("123")     # new int
  $P0 = int("123", 16) # new int base 16
  $P0 = int(2.9)       # truncate float

If the argument doesn't fit into the integer range a long (BigInt) is constructed. This functionality is implemented for a few types with the C<invoke> vtable as class methods of the PMCs.

We need offical PDDs about the behavior of our PMCs. I hope that Perl6 types will be the same as Perl5 types.

leo



Reply via email to