Hacker News new | ask | show | jobs
by munificent 2925 days ago
As far as I know, both Hack and Flow are unsound and don't do any runtime type checks to preserve soundness. It's a lot easier to migrate dynamic code to a static type system if you have the luxury of just ignoring the type system when you want to. :)

In Dart 2, the type system is sound and checked at runtime in cases where it can be proven statically safe (downcasts, variance, etc.). That makes it a lot more work to migrate because the code actually needs to run correctly without violating any of the dynamic type tests.

1 comments

The Flow core type system is sound: https://dl.acm.org/citation.cfm?doid=3152284.3133872, although there are unfortunately some known unsoundnesses in the actual type system. Does Dart suffer from the same?

Hack does check type hints at runtime, so it's "sound" in the same sense as Java might be. Is this the same sense in which Dart is sound?

> the type system is sound and checked at runtime in cases where it can be proven statically safe

I didn't understand this. If the code is statically proven safe, why would you need runtime checks?