News for hackers. Stuff that matters.
Re:Why don't more languages offer flow typing? by ljloisnflwef on Monday April 04, 2022 @07:25PM (#30913292)
In this example, it's why Java added sealed interfaces, otherwise left with ∞ - 1 possibilities.

  if (!(node instanceof DomNode.Element)) {
    return new RenderNode.Noop(/* ... */);
  }
  Layout layout = node.layout;
  return new RenderNode.Styled(layout, /* ... */);
Re:Why don't more languages offer flow typing? by kragen on Monday April 04, 2022 @07:43PM (#30913437)
It's true that we return a `RenderNode.Noop` in ∞ - 1 cases, but that's okay because we're not making any demands of `node` there.