Adrian Hey wrote:
But toplevel things with identity (TWI) are evil as well, *especially* if they are easy to use.
Just repeating this again and again doesn't make it any more true. Neither you or any of the other nay-sayers have provided any evidence or credible justification for this assertion, nor have any of you provided any workable alternative for even the simplest example. Lennart has yet to explain how he proposes to implement his supposedly safer "openDevice". You have yet to explain how you propose to deal with stdout etc..
Personally, I can't believe I hear people arguing for global variables. I thought that went away 30 years ago. It has nothing to do with functional programming. As for openDevice, if a device should only allow a single open I would assume this is part of the device driver in the operating system? (I know this is shifting blame. But I think it shifts it to where it belongs. In the OS there will be an "open" flag per device.) I admit there are proper uses of global variables, but they are very rare. You have not convinced me you have one. -- Lennart