GSoC/GCI Archive
Google Code-in 2010 Parrot Foundation and The Perl Foundation

Write a new API function to get a Method from a PMC

completed by: Kristaba

mentors: whiteknight

Task Description: Parrot is developing a new embedding API in the embed_api2 branch. This work is going well and we expect to merge it soon. The API contains enough functions to make basic embedding applications work, but it does not really do enough for the needs of our embedders.

In Parrot, Methods and Subroutines are all objects themselves. In fact, they are "Sub" PMCs. To invoke a method on an object, we first look for the method PMC, then invoke the method PMC passing the invocant and arguments. The embedding API has the ability to invoke a Sub PMC, but does not yet have the ability to search for a Method PMC in an object.

Create a new API function to search for a method in an object. Write tests to verify that you can find and invoke a method using this new API

Steps to Compete:

  1. Create a fork of parrot/parrot on Github
  2. checkout the embed_api2 branch
  3. Add a new function Parrot_api_pmc_find_method() to the file src/embed/pmc.c, following existing conventions of the API. Ask for help or clarification if necessary
  4. Write a test for your new function in t/src/embed/pmc.t. Create that file if necessary. Feel free to copy from existing examples in that directory or elsewhere
  5. Build Parrot and run all tests to verify behavior
  6. Open a pull request on Github to have your changes merged.