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

There is no null

Functional languages typically don't have a concept of null for the simple reason that it's always a special case. If you strictly follow functional principles, each input must have a workable output—but what is null? Is it an error? Or within normal operating parameters, but a negative result?

As a legacy feature, null has been around since C/C++, when a pointer could actually point to the (invalid) address, 0. However, many new languages try to move away from that. Rust does not have null, and no return value as a normal case with the Option type. The case of error is covered by the Result type, to which we dedicated an entire chapter, Chapter 5, Handling Errors and Other Results.

主站蜘蛛池模板: 静乐县| 枣庄市| 昌都县| 安宁市| 牙克石市| 英超| 从江县| 栾城县| 灌南县| 岑巩县| 英超| 广平县| 嫩江县| 青冈县| 大宁县| 津南区| 临安市| 瑞金市| 茌平县| 禹州市| 茶陵县| 惠州市| 邛崃市| 武陟县| 孙吴县| 军事| 福鼎市| 惠州市| 罗平县| 永丰县| 收藏| 麻城市| 崇礼县| 雅安市| 江北区| 赣州市| 交城县| 彩票| 秭归县| 应用必备| 西乡县|