Follow Slashdot stories on Twitter


Forgot your password?

Comment Re:Concurrency? (Score 1) 173

Here is a philosophical view of the whole thing. You can think of effectful computations as functions from a World to a World where a World contains everything that we consider mutable (including RAM, the disk, the internet and so on). For example, putStrLn takes a World and a string and produces a World which is exactly like the old one except that the string has been written to the standard output.

Of course, the two Worlds - the one in which the string hasn't been output yet and the one in which it has - can't coexist. That is, once you actually output the string you can't go back to the old World. This means that if you apply putStrLn (or any other "World transformer") to a World you can't reference that World any longer, only the one that putStrLn gives you as its result. The programming language has to ensure that Worlds are accessed linearly - if you have a World and apply a function to it, you get a new World and can't reference the old one. If this is guaranteed, then World transformers like putStrLn can be evaluated simply by modifying the one and only real world. This doesn't make the language impure because the program can't detect that the old World has changed - it can't reference it.

This kind of linearity can be implemented through linear types (which is what Clean does) or monads. In general, monads don't have anything to do with side effects. But there is one particular type of monad, called state transformer, which provides linear access to an encapsulated state. And there is one particular state transformer monad (called IO in Haskell) whose state is the World. The standard library defines primitive World functions (like putStrLn) based on this monad and programmers write their programs by composing these primitives in interesting ways. There is nothing deeply magic about it.


Submission + - Bridge Champions To Be Banned For Anti-Bush Sign

unbug writes: "Not all is well in the usually peaceful world of bridge. A small, hand-written sign reading "We did not vote for Bush", held up during the award ceremony at the World Championships in Shanghai by the winning USA women's team, has created a veritable thunderstorm. The culprits are now facing at least a one-year suspension and 200 hours of community service each provided they agree to apologize and say who came up with the idea in the first place. The United States Bridge Federation has threatened "greater sanction against anyone who rejects this compromise offer". The Federation is concerned that the team's action "reflects a complete disregard for the fact that the Chinese government, which does not exactly have a history of sympathetic views toward political dissent, provided the bulk of financial support for both the 2007 World Championship and the 2008 World Bridge Olympiad". The team members are mostly professional players who earn a large part of their income by playing in USBF and international tournaments."

Submission + - US Bridge Team to be blacklisted for antiBush sign (

An anonymous reader writes: In a fight reminiscent of the brouhaha over an anti-Bush statement by Natalie Maines of the Dixie Chicks in 2003, a team of women who represented the United States at the world bridge championships in Shanghai last month is facing sanctions, including a yearlong ban from competition, for a spur-of-the-moment protest.

Slashdot Top Deals

Truth has always been found to promote the best interests of mankind... - Percy Bysshe Shelley