- Learn Scala Programming
- Slava Schmidt
- 141字
- 2021-06-10 19:35:44
Type constraints
Type constraints are rules associated with a type. They define a subset of all types that, for example, a variable can have. A type constraint takes the form of lower bound (subtype relation) or upper bound (supertype relation). It is possible to define multiple constraints for a single type. In this case, a type must satisfy both of them. Constraints are defined using the symbols >: (lower, unhappy bound) and <: (upper, happy bound), and the direction of the sign corresponds to the reversed direction of the arrow on the UML diagram, as shown in the following screenshot:
The type constraints are inclusive, which is why type B represents both the upper and lower bounds. Besides B in our type hierarchy, only A obeys the LOWER type constraint and only C obeys the UPPER constraint.
- HornetQ Messaging Developer’s Guide
- Learning Real-time Processing with Spark Streaming
- C語言程序設計案例教程(第2版)
- Python從入門到精通(精粹版)
- R語言數據可視化實戰
- Java程序設計與計算思維
- RTC程序設計:實時音視頻權威指南
- Python王者歸來
- 網站構建技術
- Learning FuelPHP for Effective PHP Development
- 微服務架構深度解析:原理、實踐與進階
- C語言從入門到精通
- Procedural Content Generation for C++ Game Development
- Mastering ASP.NET Core 2.0
- Selenium自動化測試實戰:基于Python