3 ms·
Doesn't the fact that you had to write this treatise (which, due only partially to syntax impedance, I frankly don't understand) to explain how to set a flippin
by ajross 17y ago
Doesn't the fact that you had to write this treatise (which, due only partially to syntax impedance, I frankly don't understand) to explain how to set a flipping global variable maybe clue you in that it's kinda complicated in functional languages? :)
- pictureotf 17y agoThis says more about your understanding of Haskell than anything else, really. The GP's example is not a _global_ variable, by the way. Global variables are not really available in Haskell, except if you use unsafePerformIO: import System.IO.Unsafe {-# NOINLINE global #-} global :: IORef Int global = unsafePerformIO $ newIORef 0
- ajross 17y agoIgnorant as charged, I guess. And the fact that neither of you can see the embarassing complexity of these solutions relative to, again, setting a variable reflects what, your corresponding ignorance of von neumann architectures?
- jrockway 17y agoOh, we see the "complexity" in implementing this. (Note: not very complex in real life.) But we also see the embarrassing complexity of maintaining software that uses a "quick global variable" here and there. It's nice to know what your software does without having to guess and pray. That is worth saying "runState foo 42" instead of just "foo".
- ajross 17y agoRight. So you guys are purists who refuse to use imperative constructs even when they're objectively simpler, either because (1) you see hidden costs the rest of us don't or (2) you're wrong. Isn't that the point of this whole argument?
- jrockway 17y agodue only partially to syntax impedance, I frankly don't understand Consider: foo <- bar the same as: var foo = bar(); and: foo >>= bar like: var x = foo(); return bar(x); and: foo >> bar as: foo(); return bar();