4 ms·
Justify the need for nullability by default (and not something like the Maybe monad) to implement (say) a process scheduler. Justify the need for nullability by
by sid0 15y ago
Justify the need for nullability by default (and not something like the Maybe monad) to implement (say) a process scheduler. Justify the need for nullability by default (and not something like the Maybe monad) to implement a network stack. Go does GC itself, so writing a garbage collector in Go is too inception-y.
My point is that it's stupid and harmful to do a little better than C when you can actually learn from experience [1] and the last forty years of PL research and do much better than C.
[1] http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake http://qconlondon.com/london-2009/presentation/Null+Referenc...
- derefr 15y agoEdit: I see that you've changed your request. This was originally "justify the need for (say) unsafe pointers in (say) a process scheduler." A process scheduler's job involves saving and unloading the virtual memory mapping of a process that is blocked or pre-empted, and overwriting it with the virtual memory mapping of a new process. The process scheduler must have direct access to physical memory in order to perform this transition. Any kind of pointer safety would be built on top of a virtual memory abstraction; the process scheduler must necessarily be outside of this abstraction to do its job.
- sid0 15y agoThe process scheduler must have direct access to physical memory in order to perform this transition. Given that a scheduler's going to be running in kernel mode, why can it not just muck around with kernel address space and leave it to the page table to do the translation? Yeah, I did clarify my request a little -- by safe I meant safe with optional nullability.
- ori_b 15y agoHow does it muck about with the kernel address space again? Oh right, by writing to magic locations in memory. The same way that you interface with virtually all hardware, for that matter.
- sid0 15y agoNo, you misunderstand: I believe most of the operations you need to perform a context switch are safe in the kernel's context. Sure, you'll need a bit of assembly code to copy out and set registers and stuff, and you can't do that bit in C either. But other than that, safe pointers should work.