News for hackers. Stuff that matters.
Re:Is sound gradual typing dead? by mannykannot on Sunday February 07, 2016 @11:23AM (#11053357)
I am wondering what would happen if you left out the addition of run-time checks, and performed only those static checks that the partial typing has enabled? (I guess that would make it unsound, but perhaps it is worth it.)

I would not be at all surprised to learn that little or no static checking is possible until quite a lot of typing has been completed. We see, however, that the performance lattice in the article shows (for that particular example) that the net cost begins falling after about half of the typing is completed. Is it valid to assume that this is a result of additional type information allowing static analysis to remove or simplify run-time checks? If so, we can also note that this is a net effect, so static analysis could be having some benefit earlier in the transformation.

Re:Is sound gradual typing dead? by skybrian on Sunday February 07, 2016 @11:53AM (#11053519)
Yes, unsound gradual typing is clearly worth it. For example, using Typescript shouldn't have any performance penalties over JavaScript since it's purely a compile time thing.
Re:Is sound gradual typing dead? by munificent on Sunday February 07, 2016 @01:16PM (#11053950)
> if you left out the addition of run-time checks, and performed only those static checks that the partial typing has enabled?

This is effectively what "optional types" are, which is a sort of sister technology to "gradual types". With optional types, they are only used to show static type errors to the user during development time. At runtime, all of the type annotations are ignored and the program runs like it is fully dynamically typed.

This is how Dart, TypeScript, and (I think) ActionScript, Hack, and Flow work. You'll note that those are all languages from industry and have had various degrees of success and real-world usage.

Dart can also be run in "checked mode", which means it will also do the runtime checks with worse—but not catastrophically so— performance. Sort of like running a debug build with asserts enabled. (And, in fact, checked mode also enables the assert() statement in Dart.)

Re:Is sound gradual typing dead? by vanderZwan on Sunday February 07, 2016 @02:32PM (#11054361)
Where does Julia fit in here? Is it optionally typed or gradually typed? Because from what I understand its design choices make it a much simpler language to JIT-compile than JavaScript or Lua.
Re:Is sound gradual typing dead? by skybrian on Sunday February 07, 2016 @06:58PM (#11055645)
Julia is in a category by itself because it requires runtime reflection on types to do just-in-time compilation of code at the time of a method call.

It looks like it would be quite hard to translate Julia code to another language that doesn't have multi-method dispatching, so you pretty much need a Julia VM to run it.