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

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.

主站蜘蛛池模板: 紫阳县| 康保县| 定结县| 日土县| 鲁山县| 忻州市| 凤台县| 吕梁市| 同心县| 丁青县| 夹江县| 元朗区| 灵石县| 台南县| 陆丰市| 玉环县| 镇赉县| 汉源县| 巫溪县| 旬阳县| 天峨县| 巴南区| 赤壁市| 文登市| 微山县| 荆州市| 晋州市| 且末县| 宜黄县| 高陵县| 天长市| 称多县| 颍上县| 湘潭县| 九龙县| 手机| 平武县| 台东市| 景泰县| 镇原县| 益阳市|