- 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.
推薦閱讀
- Visual Basic程序開發(學習筆記)
- ASP.NET Core Essentials
- JavaScript Unlocked
- INSTANT Sencha Touch
- Python高級編程
- Python數據可視化之Matplotlib與Pyecharts實戰
- Kotlin從基礎到實戰
- Linux:Embedded Development
- GameMaker Essentials
- Serverless Web Applications with React and Firebase
- Python程序設計開發寶典
- Modernizing Legacy Applications in PHP
- Learning Grunt
- Java EE 8 and Angular
- Kohana 3.0 Beginner's Guide