3 ms·
Contrary to the hype, I think plenty of useful code does still run in a single-threaded environment, so I find your argument unconvincing. That said, even in a
by Chris_Newton 13y ago
Contrary to the hype, I think plenty of useful code does still run in a single-threaded environment, so I find your argument unconvincing.
That said, even in an environment with concurrency, I’m not advocating uncontrolled state changes as typified by current imperative programming languages. I’m arguing that we could benefit from the robust theory underlying languages like Haskell, but used more transparently so the developer only has to worry about it when it matters.
For example, you could be running a second thread in parallel with the one we’re looking at here, but if its effects are constrained to replying to a network-supplied request for the current time and reading the system’s clock, it doesn’t matter at all that our interactive adder is running at the same time. These effects affect different, independent resources and will never interact, so there is no benefit to cluttering either code path with extra details.
What I’d really like to see is a language that could understand those resources and how they are affected by each thread in terms of reads and updates. I want it to stop me from modifying the code later so that it accidentally becomes vulnerable to interactions that I’m not fully controlling. I want it to provide me with tools to specify how potential interactions should be handled, in a way that is systematic and robust but otherwise as simple as possible, and that can be applied at whatever level of my design makes the most sense.
Research into type and effect systems is addressing challenges like these, but I’m hoping that when the dust settles, the final version will look a lot more like Python with a few strategically placed annotations than Haskell where these implementation details are in your face all the time (even if most of the time you don’t actually need to worry about them).
- runT1ME 13y ago>I want it to stop me from modifying the code later so that it accidentally becomes vulnerable to interactions that I’m not fully controlling. I want it to provide me with tools to specify how potential interactions should be handled, in a way that is systematic and robust but otherwise as simple as possible, and that can be applied at whatever level of my design makes the most sense. That's...the state monad. The compiler tells you when you try to access it in a way that is not allowed. You have to be explicit with sharing.
- Chris_Newton 13y agoThat's...the state monad. The compiler tells you when you try to access it in a way that is not allowed. But the price for that is that I always have to access it in a cumbersome way, even when being so explicit makes no useful difference to the correctness of my code. You have to be explicit with sharing. I don’t want to be explicit with sharing. I want to be explicit with sharing when it matters, and otherwise not to worry about it, safe in the knowledge that the language will warn me if I try to do something later that invalidates any assumptions I’m making now.
- pekk 13y agoIf your argument is that it's better to be explicit with sharing, then why would you want to use threads that implicitly share 'total'?