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

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.

主站蜘蛛池模板: 临沧市| 蒲城县| 韶山市| 宁蒗| 竹北市| 隆安县| 襄汾县| 威海市| 唐海县| 青阳县| 泾川县| 达拉特旗| 四会市| 洱源县| 应用必备| 富阳市| 临沭县| 漯河市| 洛宁县| 遂溪县| 方城县| 松阳县| 微山县| 井冈山市| 元谋县| 新晃| 墨玉县| 遂宁市| 永州市| 海阳市| 伊宁市| 萨迦县| 海城市| 汉中市| 临高县| 桐庐县| 钟山县| 寻乌县| 佛教| 芦山县| 贺兰县|