Move method get_fd() from FileHandle to Handle
completed by: Fernando Brito
Task Description: The FileHandle PMC type allows the Parrot virtual machine to access files on the hard disk. This type inherits from the Handle type, which is an abstract parent class of all IO types. There are other types which inherit from Handle, including StringHandle and Socket. All of these types should behave similarly.
The FileHandle type has a method called get_fd(), which returns the system-dependent file descriptor. This is typically an integer, or can be converted to an integer. This method should be moved to the Handle class, and inherited by all Handle types (StringHandle and Socket).
Steps to complete:
- Fork the parrot/parrot repository on Github
- Move the get_fd() method from src/pmc/filehandle.pmc to src/pmc/handle.pmc, including all documentation.
- Override get_fd in src/pmc/stringhandle.pmc to always return -1 unconditionally
- Add a test for the method to t/pmc/stringhandle.pmc, to show that it always returns -1
- Add a test for the method in t/pmc/socket.pmc to show that the socket identifier is returned (and is NOT -1)
- Build parrot and run all tests to ensure that nothing has broken.
- Open a pull request on github to have your changes merged back in to Parrot
Benefits: Many changes are planned in the near- and medium-term future for Parrots IO system. Creating a common interface for all IO types to share will help to simplify logic and make future development tasks much easier
Links: https://github.com/parrot/parrot, http://trac.parrot.org/parrot/wiki/IOTasklist