Hacker News new | ask | show | jobs
by rujuladanh 2636 days ago
Yes, yes, of course. All my C programs are pure too!

They are a simple mapping of a tuple (hardware state, queue of world events) onto itself! Truly marvelous!

Vive la pureté!

PS. I am now working on abstracting this further, and I just realized the universe itself is pure too; but somehow I got some strange behaviors when I started to look into particles too closely... will report back soon.

2 comments

You are really not getting this distinction, I'm not sure how much clearer I can make it. You can evaluate `putStrLn "hello"` a billion times without anything "happening" at all, because it is just a function. Maybe it has to be made clear that purity is a property of languages and language constructs, and how you can reason about them, if you model a physical system mathematically of course you will have a pure formal description of it, but that's not the domain where this concept applies. Even then, it can only be said of your _model_ that it is pure, and the point of pure languages is to allow for this mode of reasoning.

When you call a C function, you cannot know whether equational reasoning holds, whereas you can be sure when you're using a pure language. Therefore, when you're working on a project that is 100% in say Idris, you are in fact making a totally pure program. You could make an Idris compiler that inserts random perturbations in various functions, or you could look at crashes etc., but that is not where the concept of purity applies, it's a category error to think it does.

All right, but...

When I actually get output that says "hello", that isn't pure, is it? And there is some way for me to actually produce that output, isn't there? It may not be "evaluating putStrLn", but it's something.

And if that's all true, then rujuladanh is essentially correct: You're being pedantic in a way that misses the main point.

He has a point though. You can imagine that all c code lives implicitly in an io monad and define evaluation the same way Haskell does. Then c becomes pure by your own criteria.

If you say that c is impure you have to admit that any program with the io monad also is. That is, any working Haskell program, even if Haskell allows you to write part of this program out of the io monad.

Weren't all Java programs supposed to be "100% Pure" a while back? Whatever happened to Sun Microsystems' "100% Pure Java" [TM] Initiative?

https://www.oracle.com/technetwork/java/100percentpurejavaco...

>[...] 100% Pure Java, JavaStar, JavaPureCheck, [...] JavaSpin, HotJava, The Network Is The Computer, and JavaStation are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries.

Registering purity as your trademark and insisting that all of your users rewrite every bit of their existing legacy code in your pure language, and never use or talk to any other languages ever again, always seemed like separatist linguistic supremacy to me.

Apparently, C#'s P/Invoke is an evil impure cross-language conspiracy to dilute our linguistic purity and sap our precious bodily fluids, breeding caravans of mongrel coders who will swarm across our open borders and steal our jobs. That's why JNI and NDK are only used by unpatriotic second class citizens with divided loyalties, so they don't deserve to be well supported or maintained.

https://www.zdnet.com/article/100-pure-java-initiative-wins-...

>"Keep Java pure" is the message behind Sun Microsystems' 100% Pure Java initiative which has already won support from 100 developers but will lock out programs such as Visual J++. The move is an attempt on behalf of the Californian firm to maintain integrity of Java code and build awareness.

https://www.cnet.com/news/100-pure-java-watered-down/

>Viewers of cable news network MSNBC may recently have seen a commercial for Sun Microsystems (SUNW) in which a man tells a priest that he's been thinking "pure" thoughts. When the beatific man exits the confessional, he passes a queue of anxious programmers--one wearing a Visual Basic shirt--ready to admit their sins.

>The commercial, which touts Sun's "100 percent pure Java" campaign, is not your usual television ad. But Sun has in many ways shown an almost religious determination to spread the gospel of Java to the far reaches of the globe, even sponsoring a worldwide educational tour for programmers with the support of Netscape Communications, IBM, and Novell.

It is being enjoyed every day by those of us that develop on Windows and deploy on JEE containers running somewhere, by uploading a JAR/WAR/EAR into them.