On Thursday, August 23, 2012 8:29:03 AM UTC+2, Jeffrey Sarnoff wrote:
all of the examples I have noticed of two-argument methods that take an io argument have this partial template
functionName(io::IO, secondArg::secondArgType)
in what circumstances would the IO in "io::IO" be something other than IO?
For show(), show(io::IO, x::SomeType) is the template.
For print(), print(io::IO, x::SomeType) is the template used by those few types that have a natural string representation.
For those, if it just says io instead of io::IO, it's generally an oversight. (There's also a few show() methods defined before the IO type)
If you create your own function, you're of course free to use whatever conventions you like.
But the IO type should guarantee the existence of some basic IO operations. Which ones, I would like to know. (since I've been writing my IO types)