3 ms·
You probably just want a dependently typed language. Proving bounds at compile time is an introductory exercise for the likes of Idris.
by andrewflnr 8y ago
You probably just want a dependently typed language. Proving bounds at compile time is an introductory exercise for the likes of Idris.
- zem 8y agoats [http://www.ats-lang.org/ http://www.ats-lang.org/] is a C-level language with dependent types
- lodi 8y agoNote that ATS has a limited version of dependent types as compared to Idris/Agda/Coq/etc. As I understand it, you can't run arbitrary (recursive, etc) functions at the type level. But even this 'lite' version lets you express preconditions like "n is a multiple of 4" or "the source array and destination array must not overlap in memory".
- simcop2387 8y agoQuite possibly that's what would work. I haven't tried any of them in any kind of serious capacity before. Edit: Looks like there's been an RFC in the past to add it to rust, but it got punted because the const generics stuff went in first and they wanted to see how that would shake out before trying to fully tackle this. https://github.com/ticki/rfcs/blob/pi-types-ext-2/text/0000-fully-dependent-pi-types.md https://github.com/ticki/rfcs/blob/pi-types-ext-2/text/0000-...