On Wed, Dec 28, 2011 at 2:26 PM, Graydon Hoare <gray...@mozilla.com> wrote: > If typestate turns out to be unusable for anything interesting in its > current level-of-power -- plus or minus minor usability adjustments -- we're > more likely to remove it altogether than try to enhance it to the > theoretical level of dependent types. They're a Big Deal.
An alternative would be to special case support for integers in types/predicates, as they seem to cover the vast majority of the use cases for "simple" dependent types (i.e. the ones you'd actually want to write). For example, you'd be able to track that the length of a list is within some static bounds, and adjust them after each operation that may modify the list's length so that the bounds remain conservative, and then when passing it to something that requires that it has >1 element in it, you can determine if this is true or false or not statically knowable (the latter would require a runtime check). So simple logic, special cased for just integers (and maybe some handful of other simple things), but not a full dependent type system. It's ad-hoc, but it may be that some simple "hacks" like this covers the majority of the benefit of dependent types without the complexity of a general system. -- Sebastian Sylvan _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev