- Learn Scala Programming
- Slava Schmidt
- 199字
- 2021-06-10 19:35:47
Summary
The type system is one of the key components of the Scala language. It allows the developer to express expectations about the behavior of the program, which can then be checked at compile time. This reduces the number of tests needed to verify the correctness of the solution and the possibility of runtime errors.
Usually, strictly typed languages are associated with verbose code. Normally, this is not the case with Scala because of its powerful type inference mechanism.
Scala allows you to define very narrow types containing a single value as well as much wider types, even those represented as a combination of other types.
The type definition can be made more precise by using type constraints, type parameters, and variance.
We also looked at some examples of how the type system can be used to express domain constraints.
Needless to say, Scala's ecosystem is much richer than what we have covered here. Some open source libraries offer advanced type constraints that are expressed as refined types, fixpoint types, or tagged types. Other libraries, such as shapeless, provide the possibility for type-level programming, which allows you to express and verify quite complex program logic at compile time.
- TypeScript Essentials
- CentOS 7 Linux Server Cookbook(Second Edition)
- Developing Middleware in Java EE 8
- TestNG Beginner's Guide
- PhpStorm Cookbook
- Creating Stunning Dashboards with QlikView
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- Building Android UIs with Custom Views
- Visual Basic程序設計上機實驗教程
- CoffeeScript Application Development Cookbook
- Procedural Content Generation for C++ Game Development
- Unity 3D腳本編程:使用C#語言開發跨平臺游戲
- 后臺開發:核心技術與應用實踐
- QPanda量子計算編程
- 大學計算機基礎實訓教程