TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Pissed off about functional programming (2005)

102 点作者 yiransheng将近 11 年前

13 条评论

viraptor将近 11 年前
Maybe I&#x27;m missing something, but points 3 and 4 don&#x27;t make much sense to me. Could someone tell me why I&#x27;m wrong here?<p>In myth 3 he seems to mix words of description and the words describing logical equivalence. &quot;even though equals(&#x27;three&#x27;,3) is true, length(&#x27;three&#x27;) does not equal length(3)&quot; - while this is correct, it only seems to say anything about the myth because of the function name. Try this instead &quot;even though foobar(&#x27;three&#x27;,3) is true, length(&#x27;three&#x27;) does not equal length(3)&quot; - does this really prove anything? You could never substitute &quot;three&quot; with 3 at any point in the first place.<p>Specifically he hid a &quot;$lut{ $str }&quot; in equals(). It&#x27;s not that 3 can be substituted with &quot;three&quot; - it can be substituted with &quot;$lut{&quot;three&quot;}&quot;.<p>In myth 4 he seems to play a similar trick of talking about the variable names. Sure, perl allows you to create a new block with a new variable of the same name. I&#x27;m not sure what does that have to do with functional programming as a whole. It&#x27;s just the language implementation that allowed you to play this trick - referring to a new thing by a name you used before.
moron4hire将近 11 年前
&gt;&gt; I just had an long and very frustrating conversation with a young programmer who recently discovered functional programming, and thinks it can solve every problem in the world.<p>I&#x27;m struck by A) the arrogance of such a statement, and B) how completely unsurprised I am by it. The fact that the rest of the article is nitpicky stuff of no real consequence, with a heaping helping of strawmen and goal-post moving, only supports this. This is a person who fears <i>being wrong</i> and is defending their turf.<p>For the proverbial &quot;you&quot;, because this is an endemic problem in our industry:<p>It&#x27;s not necessary to defend turf, both if you are right and if you are wrong. Obviously, if you are wrong, it saves you time to have someone else figure it out for you and then you can adjust accordingly (you&#x27;re going to adjust once proven wrong, right?).<p>But if, in some weird happenstance that has yet to be demonstrated in history, you&#x27;re right, you have expended no effort to defend your position. Sometimes, you have to let people learn their lessons the hard way. Let the youngsters run in their enthusiasm and trip and fall on their face sometimes. It&#x27;s the only way to build a <i>healthy</i> fear of novelty-for-the-sake-of-novelty, and instill some critical thinking as a matter of course.<p>It&#x27;s not necessary to be &quot;right&quot; all the time. Just because there are people in the world who are &quot;Doing it Right&quot; versus &quot;Doing it Wrong&quot;, doesn&#x27;t mean you have an ordained duty to inform them.<p>Because I&#x27;m really getting sick and tired of being asked &quot;why didn&#x27;t you use &lt;whatever I like&gt; for that &lt;whatever you wrote&gt;?&quot;
judk将近 11 年前
I assume this post is here to show us that the stupid argumentation about FP vs OOP vs DWIM have been going in circles forever and we should just stop and get back to work.
评论 #8141769 未加载
评论 #8141498 未加载
tel将近 11 年前
While knowledgable sounding... I kind of feel like he was missing out on what pure FP can and does achieve. There were many statements to the effect of &quot;don&#x27;t pretend X is Y because while Y is obviously great, it&#x27;s also true that any lang which does Y could not operate (here&#x27;s an example in Perl)&quot;.<p>I reject that last bit, that these things Y lead to a useless language though I do think the proof was far from the pudding 9 years ago.
评论 #8141349 未加载
discreteevent将近 11 年前
&quot;Even a side-effecting function call in C has a well-defined &quot;value&quot; as a state transformer that maps states to pairs of states and values (the so-called &quot;monad&quot; in functional programmers&#x27; terminology). The reluctance of functional programmers to call such languages &quot;referentially transparent&quot; merely implies that they are reluctant to admit such complex mathematical&#x2F;conceptual objects as &quot;values&quot;. On the other hand, they seem perfectly willing to call a state transformer a &quot;value&quot; when it is put in their own favourite syntax and dressed up with a buzz word like &quot;monad&quot;. I have to say that they are being entirely inconsistent, even if we grant it to them that their idea of &quot;referential transparency&quot; has some coherence.&quot;<p><a href="http://stackoverflow.com/a/11740176" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;11740176</a>
评论 #8142382 未加载
评论 #8143222 未加载
评论 #8142839 未加载
评论 #8142862 未加载
efnx将近 11 年前
I think his argument held more weight in 2005. Even though Haskell at that point was 10 years old I dont think it was quite the poster child of FP it is today.<p>It&#x27;s my guess that he&#x27;s talking about non-pure FPLs like Lisps and MLs, which today don&#x27;t seem nearly as FP as Haskell, Idris, Agda, Coq - the langs that are now carrying the FP torch.
评论 #8141873 未加载
评论 #8142865 未加载
andrus将近 11 年前
Relevant discussion on LtU: <a href="http://lambda-the-ultimate.org/node/678" rel="nofollow">http:&#x2F;&#x2F;lambda-the-ultimate.org&#x2F;node&#x2F;678</a>
amithgeorge将近 11 年前
As a beginner with knowledge of only F# and Clojure, I feel a lot of his issues are solved with having immutable values.<p>&gt; It&#x27;s theoretically possible that the &#x27;f()&#x27; or &#x27;x&#x27; might change between the lazy evaluation of step one and the lazy evaluation of step three million. Trying to prevent that is what we programmers call a &#x27;hard&#x27; problem.<p>and the examples he gives in Myth 3 &amp; Myth 4 where he reassigns `x` to mean something else. Both of these can be avoided had x been immutable.<p>I agree with the conclusion in Myth 2. I didn&#x27;t understand the latter half of Myth 3, so can&#x27;t comment on that.<p>Am I missing something wrt my assumption of immutable values solving most of the issues?
评论 #8142361 未加载
ExpiredLink将近 11 年前
Here&#x27;s another myth: &quot;Functional programming solves the concurrency problem&quot;.<p><a href="http://www.infoq.com/presentations/java-performance" rel="nofollow">http:&#x2F;&#x2F;www.infoq.com&#x2F;presentations&#x2F;java-performance</a><p>Scroll to 41:05
评论 #8142649 未加载
sdegutis将近 11 年前
To be fair, I&#x27;ve done a fair bit of Clojure and Ruby in my short career, and while it&#x27;s technically possible to write Ruby code in a Clojure-esque style, it&#x27;s very ugly and Ruby does not make it very easy. When you write in Ruby, use classes or you will have a headache on your hands!
评论 #8143122 未加载
SeanLuke将近 11 年前
Wait, since when did functional programming imply immutability? I think fifty years of lisp would like to have a few words with this fellow.
评论 #8142353 未加载
评论 #8142166 未加载
评论 #8142131 未加载
评论 #8142164 未加载
kelvin0将近 11 年前
I don&#x27;t quite get why the &#x27;Substitutability&#x27; code snippet fails? Is it because the both vars &#x27;point&#x27; to the same RAM address initialized with &#x27;3&#x27;? If that is the case, I would argue the language is somewhat broken, or at least it`s a major caveat ... Please explain?
评论 #8142640 未加载
评论 #8142268 未加载
wyager将近 11 年前
&gt;It&#x27;s theoretically possible that the &#x27;f()&#x27; or &#x27;x&#x27; might change between the lazy evaluation of step one and the lazy evaluation of step three million.<p>You can&#x27;t re-bind values in the lambda calculus, so no, they never will change. This is why languages like haskell are immutable.<p>His complaint #3 also relies on the false assumption of a mutable language.<p>Complaint #4 was solved by monads, quite a while ago.