Questions tagged «strong-typing»

10
为什么主流的强静态OOP语言阻止继承基元?
为什么这样可以正常进行并且通常可以预期: abstract type Shape { abstract number Area(); } concrete type Triangle : Shape { concrete number Area() { //... } } ...虽然这还不行,但是没有人抱怨: concrete type Name : string { } concrete type Index : int { } concrete type Quantity : int { } 我的动机是最大限度地使用类型系统进行编译时正确性验证。 PS:是的,我已经读过这篇文章,并且包装是一个棘手的解决方法。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.