logoalt Hacker News

gpderettalast Sunday at 8:56 PM1 replyview on HN

You can do arbitrary computations as part of type checking in C++, yet I don't think it should be considered dependently typed.

It seems to me that dependent typing strictly requires going from runtime values to types.

(You can parametrize types by runtime values in c++ in a trivial sense, by enumerating a finite set a compile time and then picking the correct type at runtime according to a runtime value, still I don't think it counts as the set of valid types would be finite).


Replies

zozbot234last Sunday at 9:04 PM

The "runtime" values of a dependent type system are not quite runtime values either, because the computation is happening at compile time. When you "extract" a program from a dependently-typed to an ordinary programming language that can compile down to a binary, the dependent types are simply erased and replaced with ordinary, non-dependent types; though there may be "magic" casts in the resulting program that can only be proven correct via dependent types.

show 1 reply