1) builtin methods are living in a class namespace e.g.

  Float."cos"
  ParrotIO."open"  # unimplemented

2) these methods can be called in various ways:

  Px = cos Py                  # opcode syntax
  cos Px, Py                   # same
  Px = "cos"(Py)               # function call
  Px = Py."cos"()              # method call
  cl = getclass Float
  Px = cl."cos"(y)             # class method
  m =  getattribute cl, "cos"
  Px = m(y)                    # bound class method
  m =  getattribute y, "cos"
  Px = m()                     # bound object method

3) the function PMC lookup is now done in two different ways:

- if the function name is in the current namespace:

   set_p_pc   # get Sub PMC from constant table

- else

   find_name Px, Sy

find the name Sy in lexicals, globals, builtins in that order.

This is used for PIR function calls like:

  foo()

Related changes:
- PyNCI has now it's own invoke because NCI.invoke is shifting arguments down for class methods. (Py* methods are passing the object in P5)
- sort tests didn't a proper find_global
- 1 dumper test used the wrong namespace
- invokecc clears now REG_PMC(2) so that a Sub PMC can detect, if it's called as a method or not


Comments welcome,
leo



Reply via email to