官术网_书友最值得收藏!

Preface

I like functional programming languages. One of my favorite features is native immutability. Some functional languages, by default, don't let you change values. What's amazing about this capability is that you can't accidentally break your application by mutating data at the wrong time. If you try, the code won't even compile.

I also dislike certain aspects of functional programming languages. On one hand, it's great that immutability is enforced the way it is. On the other hand, there are times when I just need to push aside my functional programming principles and get the job done.

The JavaScript language has many useful functional programming features out of the box. You don't need a library to compose higher-order functions, for example. Something that's difficult to get right with JavaScript is immutability. This is where Immutable.js shines.

When I first heard about Immutable.js, I pictured a library that enforced immutability on JavaScript structures and nothing more. It turns out there's much more. When you're working with immutable structures, you're constantly creating them. The Immutable.js collection API helps you create the structures you need, when you need them.

Since this is a JavaScript library, there's no immutability by default. This allows me to use Immutable.js where immutability matters, and to mutate things when I need to. This is what makes this such an essential library for applications in the real world; pragmatic functional programming that gets the job done.

主站蜘蛛池模板: 徐闻县| 即墨市| 兴城市| 饶平县| 靖宇县| 五原县| 哈密市| 鲁甸县| 永善县| 固安县| 嘉禾县| 政和县| 如皋市| 青龙| 浮山县| 百色市| 海门市| 六安市| 沙洋县| 延川县| 平阳县| 荥阳市| 屏东市| 佛学| 五河县| 襄城县| 湘潭市| 页游| 黄陵县| 怀集县| 阳城县| 桐乡市| 胶南市| 苍溪县| 浦城县| 牙克石市| 柞水县| 如皋市| 东海县| 荃湾区| 宜章县|