克罗克福德定律是什么? [英] What is Crockford's law?

查看:98
本文介绍了克罗克福德定律是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近有人提到单子论的克罗克福德定律". Google很少显示结果.有人知道这是什么吗?

Someone referenced "Crockford's law" recently with respect to monads. Google shows very little in the way of results. Anyone know what it is?

推荐答案

假定克罗克福德定律"是他在视频开头提到的诅咒,他指的是这种普遍现象(更雄辩地描述了

Assuming "Crockford's Law" is The Curse that he mentions early in the video, he's referring to this common occurrence (described much more eloquently here):

  1. X人不懂单子
  2. X人长期努力工作,单调乏味
  3. 人X经历了惊人的开悟感觉,想知道为什么其他人没有得到同样的开悟
  4. X人向他人提供可怕,不完整,不准确,过于简化和令人困惑的单子解释,这可能使他们认为单子是愚蠢,愚蠢,毫无价值,过于复杂,不必要,某些不正确的东西或出于精神上的误解 li>

以下是我认为《诅咒》存在的一些原因:

Here's are some of the reasons why I think The Curse exists:

    忘记了功能性编程与所谓的主流"编程有何不同.如果您对FP是什么以及人们为什么这么做没有很好的了解,那么使用FP构建的东西就没有意义了.这样的事情需要时间和精力
  • 忘记了作为头等公民的捕获效果与系统提供的效果(例如例外或可变状态)有何不同:与上述相同
  • 缺乏 good 激励示例.您知道,诸如这是问题,这是典型的解决方案,但是哦,等等,典型的解决方案存在这些问题,所以让我们看看如何使用monad彻底解决这些问题!"比关于空指针异常的疲倦的旧示例要花很多时间
  • 忘记了monad所提供的功能-我看到的许多"monad"示例实际上都可以像Functor或Applicative Functor示例一样正常工作
  • 忘记了Monad是在Haskell中构建的.问题:如果单子突然消失,您仍然可以在Haskell中执行I/O吗?
  • 认为单子需要语法支持或某种类型的系统
  • 认为monad仅与可变状态或I/O有关
  • forgetting how different functional programming is from so-called "mainstream" programming. If you don't already have a good understanding of what FP is, and why people do it, things built using FP won't make sense. Such things take time and effort
  • forgetting how different capturing effects as first-class citizens is from effects provided by the system (exceptions or mutable state, for example): same as above
  • lack of good motivating examples. You know, stuff like "this is the problem, here's the typical solution, but oh wait, the typical solution has these problems so let's see how we can cleanly fix those using monads!" That's a lot more work than the tired old example about null pointer exceptions
  • forgetting what a monad provides -- lots of "monad" examples I see actually work just fine as Functor or Applicative Functor examples
  • forgetting that monads are built within Haskell. Question: if monads suddenly disappeared, would you still be able to do I/O in Haskell?
  • thinking that monads require syntactic support, or a certain type system
  • thinking that monads are only about mutable state or I/O

我已经成为诅咒的受害者. :(

I have fallen victim to The Curse. :(

基于最后一个问题,听起来克罗克福德也有:那么,单子组基本上就是构建器模式吗?"恕我直言,这是一本学习自学Java技术的很棒的视频,但是如果您真的想学习monad的话,那不是很好.

It sounds like Crockford has as well, based on one of the questions at the end: "so monads are basically just the Builder pattern?" IMHO, it's a great video for learning kick-ass Javascript techniques, but not so great if you actually want to learn about monads.

如果您想学习单子,只需花时间和精力,并做很多例子.从头开始重新实现所有monad 实例和组合器.最终,您也将成为诅咒的受害者!

If you are trying to learn about monads, just put in the time and effort and do lots of examples. Reimplement all the monad instances and combinators from scratch. Eventually you will be in a position to fall victim to The Curse as well!

这篇关于克罗克福德定律是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆