3 ms·
Yes, file descriptors and whole file systems are other narrow waists that Unix has, not just files themselves! I want to make diagrams for those too. The term
by chubot 5y ago
Yes, file descriptors and whole file systems are other narrow waists that Unix has, not just files themselves! I want to make diagrams for those too.
The terminology I'd use:
File descriptors are just a way to do polymorphism in the type system of C. Basically you fall back to an "untyped" integer (similar to void*).
Go's interfaces solve this problem pretty directly, much better than C++, which can't really express it in the type system. That is, with the "-er" interface pattern like Reader and Writer.
(I think type classes do better too, but I haven't used them much. I'd like to see an article that unpacks this better in the context of file descriptor APIs)
This style relates to "versionless evolution". The key issue is that Go doesn't require you to declare that a type supports an interface. It's implicit and the compiler figures it out. That was controversial, but it is the key to enabling evolution.
Most programmers are viewing things through the lense of "strictness" and "catching mistakes", rather than evolution. ioctl() is messy as heck but has allowed a lot of evolution.
It's highly related to this discussion, which I've linked on the blog before:
https://lobste.rs/s/izpz2n/on_missed_opportunities_static_types https://lobste.rs/s/izpz2n/on_missed_opportunities_static_ty...
again linked from the main page: https://github.com/oilshell/oil/wiki/Perlis-Thompson-Principle https://github.com/oilshell/oil/wiki/Perlis-Thompson-Princip...