Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I'd like to see statically typed files and pipes

You mean homogeneous files and pipes - only text, only numbers, etc - that kind of nonsense? Static typing falls apart with heterogeneous containers.

Or you are just putting that static typing everywhere because it is so cool - typescript, huh huh?



The idea of types is a little different for files than it would be in a programming language. In a sense, all files are trivially of type [Char], but that's not really what I mean.

If program A emits XML on stdout, and program B accepts JSON on stdin, "A | B" should be rejected by the shell.

A related feature that might be useful is to be able to register checkers or filters for any file type so that if, say, same application creates a pdf file but the data it writes out doesn't look like valid pdf data, it's rejected. Or, if a process tries to write out an mp3 file, the OS converts it to an ogg file to store on disk and converts it back if the application tries to open it later as an mp3.


Would this codify that .xyz filename "extensions" are mandatory.. or would a file's "type" not be stored in-band with its name?


For media files you would be able to achieve something similar with FUSE and FFMPEG.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: