News for hackers. Stuff that matters.
Re:Is sound gradual typing dead? by susan_hall on Sunday February 07, 2016 @12:56PM (#11053853)
This sentence deserves to be examined for alternatives:

"To make all this work, you have to insert runtime checks between the typed and untyped portions of the program."

That makes it sounds as if there are 2 choices:

1.) insert runtime checks

2.) don't insert runtime checks

I'll point out that many platforms (in particular, the JVM) allow us to pursue a 3rd option:

3.) insert runtime checks in development and whenever you are debugging, but strip them out when you are in production and things are going well

You can fill your code pre and post assertions on functions. These slow your software but they give you most of the benefits of gradual typing. You can run your code with these assertions whenever you need to debug. But if you ever want a speed boost, and you feel like your software is stable and bug-free, then you can simply pass a flag to the JVM compiler, and it will strip out the assertions for you.

Re:Is sound gradual typing dead? by whoisthemachine on Sunday February 07, 2016 @02:16PM (#11054284)
Typescript (an extension to JS that adds type-safety) essentially does option 3 as well.

As the sibling noted, there are instances during runtime where the type checking fails, especially because Typescript is compiling to Javascript. I have had moments where a numeric observable in KnockoutJS had to be forced to a number when receiving a new value; the form that the observable is bound to is simply returning a string, and while the TS interface for KnockoutJS says the observable is a number, the actual JS doesn't care and just returns what the form gives it.

In some ways this is a failing of Typescript; it shouldn't allow strongly-type interfaces to be wrapped around JS that can return varying types.

Re:Is sound gradual typing dead? by spankalee on Sunday February 07, 2016 @11:39PM (#11056354)
Typescript doesn't insert any runtime type checks at all. It also can't know that interfaces for raw JS are typed wrong, because Typescript is only a static checker.

Dart in checked mode does insert runtime type checks, but leaves them out in production mode.

Re:Is sound gradual typing dead? by lindig on Sunday February 07, 2016 @01:40PM (#11054071)
Short of a formal proof (or a sound type system), you can't be sure that you never hit a type error in production that now wouldn't be caught.