Write new API functions to perform PMC-keyed lookup and set
completed by: Nagato Yuki
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, we can index into an aggregate (array, etc) using a variety of methods. We can use an integer (like an array), a string (like a hash/dictionary) or another PMC.
Create two new API functions to do lookup and set using a Parrot_PMC key. The new functions would be named Parrot_api_pmc_get_keyed_pmc, and Parrot_api_set_keyed_pmc. These functions would take a PMC and a Parrot_PMC key, and return the PMC contained at that location.
Steps to Compete:
- Create a fork of parrot/parrot on Github
- checkout the embed_api2 branch
- Add new functions Parrot_api_get_keyed_pmc and Parrot_api_set_keyed_pmc in src/embed/pmc.c. Feel free to copy from existing examples. Also, ask for help if you are having problems understanding the format of the API.
- Write tests for your new functions in t/src/embed/pmc.t. Create that file if necessary. Feel free to copy from existing examples in that directory or elsewhere
- Build Parrot and run all tests to verify behavior
- Open a pull request on Github to have your changes merged.