2 ms·
It's true that D allows all sorts of dirty tricks, like punning and unsafe casts, but only in code that is not marked as @safe. @safe code is mechanically check
by WalterBright 8y ago
It's true that D allows all sorts of dirty tricks, like punning and unsafe casts, but only in code that is not marked as @safe. @safe code is mechanically checkable to be safe. This has the ergonomic feature of drastically reducing the defect surface, in that it saves my time because with C code I constantly am reviewing the array code for possible overflows, in D I don't have to.
- wahern 8y agoThat argument isn't nearly as persuasive in kernel space as it is in user space. Certainly not when performance and bleeding-edge techniques (orthogonal to or even in opposition to the normal idiomatic patterns newer languages emphasize and optimize) are as emphasized as they are in Linux. How many bespoke hash, tree, and queue data structures exist in the Linux kernel, each with purposeful but complex data and execution flow dependencies unique to their context? Every time someone tries to unify two, one more pops up. Point being, the Linux development model--partly because of the nature of the work, partly because of the particular culture--absolutely defies attempts at drawing lines between safe and unsafe so the latter can be isolated. Code that doesn't heavily rely on unsafe techniques, directly or indirectly, wouldn't normally be in the kernel, anyhow. And particularly in a kernel environment even @safe code can do things that violate or exacerbate assumptions elsewhere in the code (e.g. complex RCU protocols), thus Linus' preference to avoid languages with a lot of implicit machinery or non-obvious execution flow. So it's not like @safe code can simply be removed from the equation.