Ticket #2113 (new cage)
Opened 11 years ago
FileHandle .puts and .print
Reported by: | whiteknight | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | core | Version: | master |
Severity: | low | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
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.