petdance/scratch — Issue #413: FileHandle .puts and .print
Author: petdance
Created: 2011-11-01 04:25:57+00:00
State: open

The two methods .print and .puts on the FileHandle PMC are nearly identical.

.puts takes a STRING and .print takes a PMC and converts it to a string using VTABLE_get_string. However, Parrot's PCC system will automatically coerce a PMC argument to a STRING parameter using VTABLE_get_string, so these two sequences are identical. Both methods call Parrot_io_putps with the string value. The only significant difference is that .print returns nothing while .puts returns the return value from Parrot_io_putps.

I suggest we merge the two methods. I don't care which name we keep, although "print" seems a little bit more friendly and non-C than "puts" does. The method can take a STRING (relying on argument autoconversion) and can return the Parrot_io_putps status value.

The amount of work to merge these methods should be small. However, we are going to need a deprecation cycle to do it.