Generic and type safe I/O model in any language

Posted by Eduardo León on Programmers See other posts from Programmers or by Eduardo León
Published on 2013-06-16T02:54:26Z Indexed on 2013/07/02 17:15 UTC
Read the original article Hit count: 444

Filed under:
|

I am looking for an I/O model, in any programming language, that is generic and type safe.

By genericity, I mean there should not be separate functions for performing the same operations on different devices (read_file, read_socket, read_terminal). Instead, a single read operation works on all read-able devices, a single write operation works on all write-able devices, and so on.

By type safety, I mean operations that do not make sense should not even be expressible in first place. Using the read operation on a non-read-able device ought to cause a type error at compile time, similarly for using the write operation on a non-write-able device, and so on.

Is there any generic and type safe I/O model?

© Programmers or respective owner

Related posts about design

Related posts about io