
Adrian Hey wrote:
I've written about 50000 lines of USB devices drivers for *BSD (in C). They work from the bare metal and up. They contain no global mutable state (except for variables that define debugging levels, because you need to access these from the in-kernel debugger).
Yes, I was aware of this. But with all due respect, if you're running with an OS already present (not what I would call bare metal :-), your device driver alone is not the entire IO sub-system. I'm not sure what you mean by it having no mutable state. Do you mean no top level mutable state, or do you mean there is no mutable state whatsoever associated with a particular USB port(device..whatever)?
I said "no *global* mutable state", by which I meant no global variables. Of course there's mutable state. This is C after all. :) (And it would there in Haskell too.) And yes, somewhere there's some global mutable state in the OS. I've never claimed that it should be totally forbidden. Various circumstances forces it upon us. What I've been claiming is that it should be avoided where possible. Which is almost always. -- Lennart