Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You need flow typing when you do pattern matching on generalized abstract data type (GADT). Here is an example in Java

    sealed interface Foo<T> permits Impl {}  // union type
    record Impl() implements Foo<String> {}  // product type

    <T> T m(Foo<T> foo) {
      return switch(foo) {
        case Impl impl -> "hello";  // flow typing T=String 
      };
    }


By that definition, many (maybe most) languages then already support flow typing.


that's not the same as what is defined in the article, and it is supported by plenty of languages




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: