petdance/scratch — Issue #414: FileHandle .puts and .print
Author: petdance
Created: 2011-11-14 05:55:56+00:00
State: open
Labels: cage, core, Pri-trivial, Sev-low

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.

Originally http://trac.parrot.org/parrot/ticket/2113