News for hackers. Stuff that matters.
Re:Hopefully more controversial programming opinions by johnpattiyson on Thursday August 30, 2012 @06:03AM (#4453869)
Not true. For example, a compiler can be a pure function. It accepts input that is the source code, and outputs the machine code. There's no side effect there. I admit it needs minor scaffolding to always read all of stdin first, and write all to stdout at the end, but the programme, as written by the programmer, is a pure function.

This is one of several ways that Haskell worked before there was an IO monad [1], all allowing pure functional useful programmes.

[1] S. Peyton Jones. Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in haskell. Technical report, Microsoft Research, Cambridge, 2010.

Re:Hopefully more controversial programming opinions by pufuwozu on Thursday August 30, 2012 @06:25AM (#4453917)
This is even the case after the introduction of the IO monad. Monads allow referentially transparent IO.

My purely functional programs actually do things! Amazing that my ivory tower allows me to say "Hello World".

Re:Hopefully more controversial programming opinions by walrus on Thursday August 30, 2012 @10:54AM (#4454916)
Yes, the 'minor scaffolding' has side effects. That's why I said it wasn't controversial.
Re:Hopefully more controversial programming opinions by qu4z-2 on Friday August 31, 2012 @03:24AM (#4458686)
The side effects in the scaffolding are purely an implementation detail.

For non-interactive use (like a compiler) you could implement the program as a function taking and returning a string.

Re:Hopefully more controversial programming opinions by walrus on Friday August 31, 2012 @09:38AM (#4459621)
How would I invoke a compiler that isn't interactive? The act of invoking it is the interactivity.