Added some thoughts about why this function is so hard to write.
ioval needs to be called with a read