News for hackers. Stuff that matters.
Re:Why don't more languages offer flow typing? by jcranberry on Monday April 04, 2022 @01:22PM (#30909356)
Sum types are often used in cases where the type is unknown at run time. In C++ the analog would be std::variant. In Rust it would be enums. In Haskell its algebraic data types.

A first class sum type in c++ ala Rust or Haskell would certainly be appreciated, as the clunkiness of std::variant/std::visit is a well known annoyance.

Re:Why don't more languages offer flow typing? by epolanski on Monday April 04, 2022 @05:53PM (#30912449)
Could you expand on your first sentence? I don't understand what do you mean that sum types are used when the type is unknown at runtime.
Re:Why don't more languages offer flow typing? by lupire on Tuesday April 05, 2022 @02:25PM (#30922878)
They meant unknown at compile-time, not run-time.