Giter Club home page Giter Club logo

Comments (1)

blueken avatar blueken commented on August 19, 2024

抱歉,迟到的回复:

首先作者在第二章, “函数输出” 这一小节,结束时 曾抛出一个思考:

提示: 在这里我十分建议你花一点时间来思考:是否需要避免函数有可重构的多个输出?或许将这个函数分为两个或更多个更小的单用途函数。有时会需要这么做,有时可能不需要,但你应该至少考虑一下。

这里,关于函数输入我向你抛一个思考:

是否需要避免函数有多个输入参数?或许将这个函数分为两个或更多个更小的单参数函数。有时会需要这么做,有时可能不需要,但你应该至少考虑一下。

先认真考虑五分钟,然后表达我的看法:

思考中〜〜〜

思考中〜〜〜

思考中〜〜〜

思考中〜〜〜

思考中〜〜〜

思考中〜〜〜

说说我的看法:

看法1。 理想情况下应该永远进行严格柯里化

看法2。 不排除有业务逻辑是需要一组相关输入的,这时候松散柯里化是有恰当的,合理的,而严格柯里化则会显得冗余。但我们还是可以变相转化为严格柯里化(把多参,使用数组或者对象的形式变成单参)

看法3。 如果你要重构一个已有的多参数方法,而这个方法已经被广泛使用了。为了向下兼容,松散柯里化是你唯一的出路。(你要严格柯里化,成千上万的调用方会追杀你)

@DaZhaoLis

from functional-light-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.