How to create a virtual file that is coupled to a program, e.g. to a `.gz` file via `gzip`?

view story

http://unix.stackexchange.com – Given e.g. a gzipped textfile file.txt.gz, how to create a special file file.txt that on reading yields the (interactively) decompressed contents of the .gz file, and on writing a) re-gzips the new content or b) denies write-access? (HowTos)