3 ms·
Languages and kernels don't exactly have the same design considerations. Types and compilers are trying to help you write valid programs for your benefit. A ker
by cropcirclbureau 4y ago
Languages and kernels don't exactly have the same design considerations. Types and compilers are trying to help you write valid programs for your benefit. A kernel only has access to machine code representation of your possibly buggy or malicious program. Sure, your language or libc might provide a convenient and object based API to the kernel but these are just wrappers over the basic number and pointer to C struct soups based syscall APIs that machine code can interface with. I.e. there's nothing exactly preventing you from providing the wrong numbers and bad structs aside from the "higher layer in the stack". At least you're allowed to mispell `cnect` accessibly so from the shell.
There are ways around this ofc like the Android Runtime that requires any code that interfaces with it to be written in Java adjacent bytecode that gets compiled to machine code (and cached) by the runtime (after being checked I imagine).
- IshKebab 4y ago> there's nothing exactly preventing you from providing the wrong numbers and bad structs aside from the "higher layer in the stack" Right, mistakes are possible in both cases. But why pick the design that is more likely to lead to mistakes (on both sides of the interface) and is slower? There's just no good reason to do it like that.