- Hands-On Data Structures and Algorithms with Rust
- Claus Matzinger
- 128字
- 2021-07-02 14:11:42
Immutable variables
Rust—like many functional languages—embraces immutable variables. They are the default, and changing mutability requires explicit declaration with mut, which tells the compiler what the variable is going to be used for (reading or writing).
Functional programming languages are known for facilitating the ability to work concurrently, thanks to immutability guarantees; reading data does not produce side effects! Requiring explicit mutability gives the compiler a chance to check where and if mutability is required, and therefore whether a data race may occur.
This results in compile-time warnings and errors instead of crashes and strange race conditions at runtime, something that many production users appreciate. In short, it's easier to think through your code if mutability is a (rare) option instead of the norm.
- 我們都是數據控:用大數據改變商業、生活和思維方式
- Microsoft SQL Server企業級平臺管理實踐
- Access 2016數據庫教程(微課版·第2版)
- 大數據可視化
- Learning Spring Boot
- Redis應用實例
- Libgdx Cross/platform Game Development Cookbook
- Spark大數據編程實用教程
- 企業級容器云架構開發指南
- PostgreSQL指南:內幕探索
- 云數據中心網絡與SDN:技術架構與實現
- Splunk智能運維實戰
- 大數據技術原理與應用:概念、存儲、處理、分析與應用
- Expert Python Programming(Third Edition)
- 信息融合中估計算法的性能評估