3 ms·
This is incredibly neat and I do not at all mean to discourage the development of more tools. However, is this really that much more capable than considering a
by taeric 13y ago
This is incredibly neat and I do not at all mean to discourage the development of more tools. However, is this really that much more capable than considering all of the other tooling that can help in writing a kernel module in C? That is, you have more than just the C compiler at your disposal nowdays. Valgrind and such.
Simply put, how much more capable is this? Certainly more concise and has some aesthetic appeal. Just curious if it brings a lot more to the table.
- Peaker 13y agoOne of the main uses of valgrind is to discover undefined behavior. Haskell doesn't have undefined behavior, so you don't need it. I don't think the C tooling is that great. Haskell has some neat tooling of its own.
- taeric 13y agoI think you are misrepresenting valgrind some. Just going by the bullet list on their homepage, they do more than just undefined. Offering fairly nice analysis at the cache level. Also, has support for finding threading errors. Note, this isn't just a "do mutexes work" sort of thing, but offers analysis that shared memory is safely shared. (And, from my understanding, this doesn't require modification of the code to make it slower/larger.) So, this really doesn't answer my question. I can't but agree that the tooling in Haskell is above that of plain C. However, what class of bugs will be prevented in the kernel, that isn't already fairly well handled with existing tooling. Consider that the kernel is actually fairly solid code, if I'm not off my rocker.
- codygman 13y agoWouldn't "class of bugs prevented by tooling" not be quite as good as "class of bugs disallowed by programming language"?
- agentultra 13y agoYou might end up in the trap of only writing correct bugs.
- codygman 13y agoCorrect bugs, logic errors I'm assuming, are a better problem to have than logic errors + undefined behavior in my opinion.
- agentultra 13y agoUndefined behavior is a perfectly acceptable abstraction [1]. The C specification is pretty clear on what it has purposefully left undefined which has made it rather resilient to changes in underlying hardware architectures. Must be why Haskell's run-time support is written in C [2] [1] http://thoughtmesh.net/publish/367.php http://thoughtmesh.net/publish/367.php [2] https://github.com/ghc/ghc/tree/master/rts https://github.com/ghc/ghc/tree/master/rts
- Peaker 13y agoUndefined behavior has advantages, of course. The C language is excellent at certain things, too. However, not every kernel driver and not every application needs the benefit of C or undefined behavior. The fact that Haskell's RTS is written in C is evidence that the kind of code in RTS's has more to gain from C than from Haskell. Some parts of drivers might also be best written in C.
- codygman 13y agoI will have to check that video out. I'm aware that Haskell's run-time support is written in C and I don't believe that is a mistake. Right tool for the job after all. For many use cases in my experience though, you don't want undefined behavior.
- Peaker 13y agoWith rich types, you can get rid of the correct bugs, too. You can encode an arbitrary amount of information into a verified, proven specification. The specification is orders of magnitude smaller and simpler than the actual code, so much easier to get correct.