- Rust Programming Cookbook
- Claus Matzinger
- 130字
- 2021-06-24 12:27:48
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.
推薦閱讀
- UNIX編程藝術
- Kubernetes實戰
- SQL學習指南(第3版)
- Java入門很輕松(微課超值版)
- The Computer Vision Workshop
- HTML5+CSS3+JavaScript Web開發案例教程(在線實訓版)
- Mastering Data Mining with Python:Find patterns hidden in your data
- Python全棧數據工程師養成攻略(視頻講解版)
- Scala Data Analysis Cookbook
- Modern C++ Programming Cookbook
- Instant Zurb Foundation 4
- 零基礎學C語言(升級版)
- Python計算機視覺與深度學習實戰
- Android熱門應用開發詳解
- Python深度學習與項目實戰