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

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.

主站蜘蛛池模板: 鄂伦春自治旗| 乌苏市| 孝感市| 涡阳县| 长汀县| 侯马市| 竹山县| 通河县| 深水埗区| 云和县| 同心县| 望谟县| 苍南县| 玉林市| SHOW| 抚州市| 南开区| 佛冈县| 惠来县| 西林县| 老河口市| 潮州市| 连州市| 海丰县| 平陆县| 舒城县| 富裕县| 中阳县| 灵石县| 香河县| 榆社县| 迁西县| 广宗县| 镇沅| 新和县| 拉孜县| 襄城县| 雅安市| 正安县| 怀安县| 平果县|