TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Can functional programming be liberated from the von Neumann paradigm? (2010)

161 pointsby stevekrouseover 6 years ago

12 comments

yasonover 6 years ago
The question is valid if you intend to stick with one paradigm and keep it pure. For any practical purposes, that&#x27;s useless crap.<p>Nothing wrong with writing the gist of your program written in functional way, keeping things immutable, allowing for orderless execution and lazy evaluation. But because your program interfaces with the real, consequential world it must realise all that computation at the pivot points where there is I&#x2F;O and it suddenly matters that the lazy evaluation is complete.<p>Have a procedural loop to drive your events and other practical stuff and, from there, launch functional computations to calculate a completely or partially new state for your program. Keep things mostly immutable but do mutation in certain specific locations where it makes sense.<p>Clojure is good at drawing the line where the programmer sees it fit best. Multi-paradigm has always beaten pure ideologies hands down when it comes to delivering useful programs that actually work without making programmers do mental gymnastics for the sake of purity. (They should reserve their efforts to be mentally gymnast in the real-world problem they&#x27;re solving.)<p>You don&#x27;t want to write all of your program in object-oriented, procedural, functional, declarative, or whatever paradigm you have a thing for. They all do some things well and suck at others. Use them like tools, the right one for the right job.
评论 #18693888 未加载
评论 #18693139 未加载
评论 #18695189 未加载
评论 #18693868 未加载
hyperpapeover 6 years ago
This piece is hard to evaluate: it seems more like an expression of hope or a manifesto than something I can engage with.<p>It argues that the idea that there is an ineleminable imperative core in our programming model is just an assumption today, and I agree.<p>But that doesn’t mean it’s right or wrong, just that we have to wait to prove or disprove that assumption. People should keep trying to disprove it, but I can’t fault the majority of developers for continuing to take it as an assumption.
michaelmroseover 6 years ago
Not at all programming related but I found this quote incomprehensible<p>&quot;Belief, as I use the word here, is the insistence that the truth is what one would “lief” or wish it to be. The believer will open his mind to the truth on the condition that it fits in with his... &quot;Faith, on the other hand, is an unreserved opening of the mind to the truth, whatever it may turn out to be. Faith has no preconceptions; it is a plunge into the unknown. Belief clings, but faith lets go. In this sense of the word, faith is the essential virtue of science, and likewise of any religion that is not self-deception.&quot; – Alan Watts<p>Faith as every human on earth uses it is a belief that that person has opted to exempt from questioning. It means in fact the opposite of his usage and all belief systems are necessarily self deception stories we make up and tell ourselves to render sensory soup a coherent narrative in which we have a part.
评论 #18695950 未加载
评论 #18697870 未加载
评论 #18694633 未加载
lbjover 6 years ago
Understanding and modelling IO is a big part of why Clojure took of like it did. Its functional, its pure-ish but it has an understanding of time, concurrency and IO baked in. When you do IO time matters, take a look at how Datomic models this (incrementally).<p>But even from the early days, Rich Hickey said that no pure functional system exists as even an empty HD emits heat, which is a form of IO and I think we should listen to Hitchens and abandon our &quot;fantasy of purity&quot; when it comes to writing real software.
评论 #18693838 未加载
评论 #18695504 未加载
deepakkarkiover 6 years ago
Was about to mention I heard about this in the future of coding podcast[0] last week, then realised this was posted by Steve (who runs the podcast).<p>[0] : <a href="https:&#x2F;&#x2F;futureofcoding.org" rel="nofollow">https:&#x2F;&#x2F;futureofcoding.org</a><p>Strongly recommend anyone interested in such topics (programming languages, rapid prototyping, HCI, low code platforms, etc) to check out his work. Steve is doing some really great work as a individual researcher!
carapaceover 6 years ago
Cf. <a href="http:&#x2F;&#x2F;conal.net&#x2F;papers&#x2F;compiling-to-categories&#x2F;" rel="nofollow">http:&#x2F;&#x2F;conal.net&#x2F;papers&#x2F;compiling-to-categories&#x2F;</a><p>Abstract<p>&gt; It is well-known that the simply typed lambda-calculus is modeled by any cartesian closed category (CCC). This correspondence suggests giving typed functional programs a variety of interpretations, each corresponding to a different category. A convenient way to realize this idea is as a collection of meaning-preserving transformations added to an existing compiler, such as GHC for Haskell. This paper describes such an implementation and demonstrates its use for a variety of interpretations including hardware circuits, automatic differentiation, incremental computation, and interval analysis. Each such interpretation is a category easily defined in Haskell (outside of the compiler). The general technique appears to provide a compelling alternative to deeply embedded domain-specific languages.
kuwzeover 6 years ago
I keep hoping to read something about bypassing the von Neumann bottleneck[0].<p>[0]: <a href="https:&#x2F;&#x2F;whatis.techtarget.com&#x2F;definition&#x2F;von-Neumann-bottleneck" rel="nofollow">https:&#x2F;&#x2F;whatis.techtarget.com&#x2F;definition&#x2F;von-Neumann-bottlen...</a>
dahartover 6 years ago
&gt; A person convinced of (and perhaps ego-invested in) the nonexistence of new possibilities is a person actively resisting their opportunity to discover possibilities — too stuck in the obvious to discover new truths.<p>Since this article is almost 10 years old... has any progress been made in demonstrating the existence of pure functional I&#x2F;O? Reading files and writing to the console is one thing, I’m more curious about human input, GUIs and language. Think about apps Photoshop, Super Mario Bros, or Sublime text. The ways we <i>want</i> to interact with them seem more fundamentally sequential. Not only can I not see how to make them pure functional, I can’t see what that even means or why it would ever be desirable.<p>&gt; Hand-waving is an important factor in staying stuck in impossibility thinking, since rigorous argument uncovers unconscious limiting assumptions.<p>You have to admire the effort to discredit any rational thinking before it starts.
评论 #18693690 未加载
siceviqover 6 years ago
I don’t know a lot about Haskell or pure functional programming. Composing entire programs sounds really desirable though, and while imagining what that would look like I came up with this:<p>Suppose we had a runtime comprised of objects, and execution was represented as messages sent between objects, as in Smalltalk. Unlike Smalltalk, however, objects would never be created or destroyed. All of our program’s logic and behavior would be represented as a pure transformation on every message between objects. In pseudo-Haskell:<p><pre><code> -- A message is a receiver identifying an object, like “Program”, and a selector, perhaps containing data myProgram :: Msg -&gt; Msg myProgram (Program {begin}) = Window {createWindowWithName=&quot;myWindow&quot;} myProgram (Program {windowCreatedWithName=name}) = (Window {windowWithName=name, setTitleTo=&quot;Hello world&quot;}) myProgram (Program {windowWithName=name, didChangeTitle=title}) = (Console {print=title}) myProgram msg = msg </code></pre> Here the runtime begins execution by trying to send the message [Program begin], but myProgram([Program begin]) evaluates to [Window createWindowWithName:&quot;myWindow&quot;], so that is sent instead. The “Window” object, when sent [Window createWindowWithName:String], both puts a new window on the screen, and sends the message myProgram([Program windowCreatedWithName]), and so execution continues.<p>It would be easy to compose programs written using this paradigm, and not hard to imagine what composition of executable programs would mean. For example, to log the name of every window created to the console:<p><pre><code> logWindowName :: Msg -&gt; Msg logWindowName (Program {windowCreatedWithName=name}) = Multicast {messages=[Program {windowCreatedWithName=name}), Console {print=name}]} finalProgram = logWindowName . myProgram </code></pre> (Here “Multicast” is supposed to be an object that can take several messages and, with no notion of order, send them out all at once.)<p>We could add yet another object representing mutable state, with messages describing changes to it and responses containing data stored there. Without using something like this to explicitly model it, I don&#x27;t see any explicit sequencing of instructions as in the IO monad.<p>Are there obvious problems with this approach, or has anything very similar been tried?
评论 #18710925 未加载
crimsonalucardover 6 years ago
How about<p><pre><code> print :: a-&gt;a </code></pre> or some variant.<p>Or<p><pre><code> print:: a-&gt;(a-&gt;b)-&gt;a </code></pre> where (a-&gt;b) is a function that extracts some value &#x27;b&#x27; out of &#x27;a&#x27; and that value &#x27;b&#x27; is printed.<p>I mean pretty straightforward. id functions in your compositions don&#x27;t effect the overall program.<p>This is only for the O part of IO. Input is a different problem.
评论 #18696157 未加载
ankurdhamaover 6 years ago
I just don&#x27;t get the idea that &quot;sequential&quot; is somehow a bad thing? The whole concept of an algorithm&#x2F;procedure to perform a computation is about performing a series of operations in a specific order. You have to think about the operations and their order as well to come up with an algorithm.
评论 #18693447 未加载
评论 #18693693 未加载
评论 #18692924 未加载
评论 #18693252 未加载
评论 #18693534 未加载
评论 #18693259 未加载
评论 #18693512 未加载
评论 #18695809 未加载
platzover 6 years ago
Is this about FRP